public bool Save() { return(WYNKContext.SaveChanges() > 0); }
public dynamic UpdateExceldata(AppointmentView UpdateExceldatas) { var registrationMaster = new AppointmentView(); var newdate = new Bankservice(); if (UpdateExceldatas.username == "Dayakar") { var totalbalance = WYNKContext.Bankservice.Where(x => x.userreferrncetype == "Userone").Select(x => x.AMount).ToList(); newdate.AMount = "-" + (UpdateExceldatas.amount); newdate.UserName = UpdateExceldatas.username; newdate.userreferrncetype = "Userone"; newdate.createddate = DateTime.Now; WYNKContext.Bankservice.Add(newdate); WYNKContext.SaveChanges(); var newdates = new Bankservice(); newdates.AMount = Convert.ToString((UpdateExceldatas.amount)); newdates.UserName = "******"; newdates.userreferrncetype = "Usertwo"; newdates.createddate = DateTime.Now; WYNKContext.Bankservice.Add(newdates); WYNKContext.SaveChanges(); } if (UpdateExceldatas.username == "Sulthan") { newdate.AMount = "-" + (UpdateExceldatas.amount); newdate.UserName = UpdateExceldatas.username; newdate.userreferrncetype = "Usertwo"; newdate.createddate = DateTime.Now; WYNKContext.Bankservice.Add(newdate); WYNKContext.SaveChanges(); var newdates = new Bankservice(); newdates.AMount = Convert.ToString((UpdateExceldatas.amount)); newdates.UserName = "******"; newdates.userreferrncetype = "Userone"; newdates.createddate = DateTime.Now; WYNKContext.Bankservice.Add(newdates); WYNKContext.SaveChanges(); } try { if (WYNKContext.SaveChanges() >= 0) { return new { Success = true, Message = "Saved successfully", } } ; } catch (Exception ex) { Console.Write(ex); } return(new { Success = false, Message = "some data are missing" }); }