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.
Unfortunately, activation email could not send to your email. Please try again.

CRUD actions using kanban control

Thread ID:

Created:

Updated:

Platform:

Replies:

125029 Jul 15,2016 09:55 AM Aug 10,2017 11:57 AM ASP.NET MVC 6
loading
Tags: Kanban
Edmund Herbert
Asked On July 15, 2016 09:55 AM


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


Sarath Kumar P [Syncfusion]
Replied On July 18, 2016 11:39 AM

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.
   


Sarath Kumar P [Syncfusion]
Replied On July 19, 2016 09:41 AM

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. 


Megatron
Replied On July 20, 2016 12:07 AM

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

Kavitha Narayanan [Syncfusion]
Replied On July 21, 2016 05:02 AM

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. 
 


syntax
Replied On August 9, 2017 04:49 AM

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.


Buvana Sathasivam [Syncfusion]
Replied On August 10, 2017 11:57 AM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;