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 actions using kanban control


Hi Guys could you give me an example of CRUD operations on the kanban control,

 I am using EF Code First MVC 5 .net 4.5.1

I want to save changes, add and delete records

Thanks in advance

Edmund Herbert


6 Replies

SK Sarath Kumar P Syncfusion Team July 18, 2016 03:39 PM UTC

Hi Edmund,

Thank you for using Syncfusion products. 
 
 
We are facing some issues with Entity Framework sample, we will update you by tomorrow(19,July 2016).  
Please let us know if you have any concerns.   

Regards,  


Sarath Kumar P.
   



SK Sarath Kumar P Syncfusion Team July 19, 2016 01:41 PM UTC

Hi Edmund, 
 
 We have created incident for your reported query. We will assist you through incident under your Direct Trac account.  
 
Our Direct Trac support system can be accessed from the following link:  
                                
 
Regards, 
 
Sarath Kumar P. 



ME Megatron July 20, 2016 04:07 AM UTC

Hi, can you post the sample here, I am interested too


KN Kavitha Narayanan Syncfusion Team July 21, 2016 09:02 AM UTC

Hi Megatron, 
We have created incident for your reported query. We will assist you through incident under your Direct Trac account.   
  
Our Direct Trac support system can be accessed from the following link:   
                                 
 
Regards, 
Kavitha N. 
 



SY syntax August 9, 2017 08:49 AM UTC

Hi,

I am facing the same problem. I pass the data from a ViewModel

.DataSource(Model.Cards)

Which works great. Now I need to be able to handle delete, update and add new actions on the server (MVC Controller). I thought I could do this;

.DataSource(d =>d.dataSource(Model.Cards).InsertUrl... but that did not work.

Any guidance is much appreciated.

Thank you in advance.



BS Buvana Sathasivam Syncfusion Team August 10, 2017 03:57 PM UTC

Hi Edmund, 

Thanks for your update. 

We had prepared Kanban control sample with CRUD operations using ejDataManagerURL property is used to load data into Kanban and CrudURL property is used to get post action for processing adding/editing/deleting/updating data’s. You can use below solution to perform CRUD actions. Please refer to the below code example and sample.    
    
   
[cshtml]      
    
@(Html.EJ().Kanban("Kanban")       
       .DataSource(ds =>      
   // To load data using  “GetData” method.     
ds.URL("GetData")     
   // added, changed, and deleted data’s can get in the CrudURL post action.     
.CrudURL("Crud").Adaptor(AdaptorType.UrlAdaptor))  //Define the DataManger.       
)     
   
    
[controller]      
 
private NORTHWNDEntities db = new NORTHWNDEntities(); 
     
public ActionResult GetData(Syncfusion.JavaScript.DataManager value)    //To render all Kanban cards.                       {                                                                      
                      var DataSource = db.Tasks.ToList(); 
           DataResult result1 = new DataResult(); 
           DataOperations operation = new DataOperations(); 
           result1.result = DataSource; 
           result1.count = DataSource.AsQueryable().Count(); 
           if (value.Skip > 0) 
               result1.result = operation.PerformSkip(result1.result, value.Skip); 
           if (value.Take > 0) 
               result1.result = operation.PerformTake(result1.result, value.Take); 
          if (value.Select != null && value.Select.Count >0) 
               return Json(result1.result, JsonRequestBehavior.AllowGet); 
           return Json(result1, JsonRequestBehavior.AllowGet);     
   }     
     
        //Edit multiple cards for priority drag and drop 
        public ActionResult Crud(List<Task> changed, List<Task> added, List<Task> deleted) 
        { 
            //Performing insert operation 
            if (added != null && added.Count() > 0) 
            { 
                foreach (var temp in added) 
                { 
                    db.Tasks.Add(temp); 
                } 
            } 
 
            ////Performing update operation 
            if (changed != null && changed.Count() > 0) 
            { 
                foreach (var temp in changed) 
                { 
                    Task old = db.Tasks.Where(o => o.Id == temp.Id).SingleOrDefault(); 
                    if (old != null) 
                    { 
                        db.Entry(old).CurrentValues.SetValues(temp); 
                    } 
                } 
            } 
 
            //Performing delete operation 
            if (deleted != null && deleted.Count() > 0) 
            { 
                foreach (var temp in deleted) 
                { 
                    db.Tasks.Remove(db.Tasks.Where(o => o.Id == temp.Id).SingleOrDefault()); 
                } 
            } 
 
            db.SaveChanges(); 
            var data = db.Tasks.ToList(); 
            return Json(data, JsonRequestBehavior.AllowGet); 
        }    
   
    
    
Please refer the below sample and UG documentation:    
    
    
  
 
Regards, 
Buvana S. 


Loader.
Up arrow icon