We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Crud Syntax in Asp.net Core(Controller)

Hi
I'm having a Problem in CRUD Syntax(IN ASP .NETCORE)         (The MVC Syntax NOT WORKING IN ASP.NETCORE)

Syntax Code available for ASP.NETCore does not work.

I need SAMPLE Syntax Code(Controller and Model) ASP.NET Core  For : BatchUpdate and CellEditUpdate and CellEditInsert and CellEditDelete and ...

Please help me to solve the problem.

Thanks.




 

3 Replies

VA Venkatesh Ayothi Raman Syncfusion Team March 30, 2017 12:12 PM UTC

Hi Hassan, 
Thanks for contacting Syncfusion support. 

We have prepared a sample based on your requirement which can be download from following link, 

In that sample, we rendered the Grid with CRUD operation and define the CRUD methods in server side. Please refer to the following code example, 
Code example
@Grid 
<ej-grid id="FlatGrid" allow-paging="true" allow-filtering="true" allow-selection="true" > 
         
    <e-edit-settings allow-adding="true" allow-deleting="true" allow-editing="true"  ></e-edit-settings> 
    <e-toolbar-settings show-toolbar="true"  toolbar-items="@(new List<string>() { "add", "edit", "delete", "cancel", "update"})"></e-toolbar-settings> 
     
    <e-datamanager url="/Home/DataSource" insert-url="/Home/CellEditInsert" update-url="/Home/CellEditUpdate" remove-url="/Home/CellEditDelete" adaptor="UrlAdaptor"></e-datamanager> 
    <e-columns> 
. . . 
          
    </e-columns> 
</ej-grid> 
 
@server side code 
//Update the data 
        public ActionResult CellEditUpdate([FromBody]CRUDModel<Orders> value) 
        { 
            var ord = value.Value; 
            Orders val = order.Where(or => or.OrderID == ord.OrderID).FirstOrDefault(); 
            val.OrderID = ord.OrderID; 
            val.EmployeeID = ord.EmployeeID; 
            val.CustomerID = ord.CustomerID; 
            val.Freight = ord.Freight; 
            val.OrderDate = ord.OrderDate; 
            val.ShipCity = ord.ShipCity; 
 
            return Json(value.Value); 
        } 
        //insert the record 
        public ActionResult CellEditInsert([FromBody]CRUDModel<Orders> value) 
        { 
             
            order.Insert(0, value.Value); 
            return Json(value); 
        } 
        //Delete the record 
        public ActionResult CellEditDelete([FromBody]CRUDModel<Orders> value) 
        { 
            order.Remove(order.Where(or => or.OrderID == int.Parse(value.Key.ToString())).FirstOrDefault()); 
            return Json(value); 
        } 

If we set editmode as batch then batch url and server side code should be like as follows, 
@GRID 
<ej-grid id="FlatGrid" allow-paging="true" allow-filtering="true" allow-selection="true" > 
         
    <e-edit-settings allow-adding="true" allow-deleting="true" allow-editing="true"  edit-mode="Batch" ></e-edit-settings> 
    <e-toolbar-settings show-toolbar="true"  toolbar-items="@(new List<string>() { "add", "edit", "delete", "cancel", "update”})"></e-toolbar-settings> 
     
    <e-datamanager url="/Home/DataSource" batch-url="/Home/BatchUpdate" adaptor="UrlAdaptor"></e-datamanager> 
    <e-columns> 
. . . 
          
    </e-columns> 
</ej-grid> 
 
@server side code 
public ActionResult BatchUpdate([FromBody]CRUDModel value) 
        { 
 
            //do stuff 
 
 
        } 

Screenshot 1
 
Screenshot 2
 
Please let us know if you have any further assistance on this. 
Regards, 
Venkatesh Ayothiraman. 



HA Hassan April 3, 2017 12:16 PM UTC

Thanks for guidance

Syntax Code available for ASP.NETCore does not work(bind to sqlserver database(BatchUpdate and CellEditUpdate and CellEditInsert and CellEditDelete and ...)

bind grid to sqlserver database and CRUD by Inline , Batch or dialog.

meantime the http://aspnetcore.syncfusion.com/grid/batchediting of asp.netcore Syncfusion Help for syntax controllers 
is Empty

Please help me to solve the problem.



AS Alan Sangeeth S Syncfusion Team April 4, 2017 01:18 PM UTC

Hi Hassan,  
  
Sorry for the inconvenience.  
  
Query 1: “Syntax Code available for ASP.NETCore does not work 
Please confirm whether the solution in previous update has resolved your problem or if you still facing issue please send us more information so that we provide you solution as early as possible. 
 
Query 2: “asp.netcore Syncfusion Help for syntax controllers is Empty 
We have created a separate incident for this query. Please log in to following link for follow-up with the incident. 
  
Regards,  
Alan Sangeeth S 



Loader.
Up arrow icon