public static bool CreateNewEvent(string Title, string Description, string NewEventDate, string NewEventTime, string NewEventDuration, EventType eventType, int EventID = 0) { try { DiaryContainer ent = new DiaryContainer(); AppointmentDiary rec = new AppointmentDiary(); rec.Title = Title; rec.Description = Description; rec.EventType = (int)eventType; rec.DateTimeScheduled = DateTime.ParseExact(NewEventDate + " " + NewEventTime, "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); rec.AppointmentLength = Int32.Parse(NewEventDuration); if (EventID > 0) { rec.ID = EventID; ent.Entry(rec).State = System.Data.Entity.EntityState.Modified; ent.SaveChanges(); } else { ent.AppointmentDiary.Add(rec); ent.SaveChanges(); } } catch (Exception) { return(false); } return(true); }
public ActionResult SaveSalaat(string Fajr, string Dhuhr, string Asr, string Maghrib, string Isha, string Khutbah1, string Khutbah2, string Jumma1, string Jumma2) { var Sataals = db.Salaat.FirstOrDefault(); Sataals.Asr = Asr; Sataals.Fajr = Fajr; Sataals.DateAdded = DateTime.Now; Sataals.Dhuhr = Dhuhr; Sataals.Maghrib = Maghrib; Sataals.Isha = Isha; Sataals.Khutbah1 = Khutbah1; Sataals.Jumma1 = Jumma1; Sataals.Khutbah2 = Khutbah2; Sataals.Jumma2 = Jumma2; db.Entry(Sataals).State = EntityState.Modified;// System.Data.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("SetSalaat")); }
public ActionResult Edit(RegisterViewModel icmb) { if (ModelState.IsValid) { //Save Member Details var member = db.IcomMembers.Find(icmb.IcomMembersId); member.Country = icmb.Country; member.FullName = icmb.FullName; member.State = icmb.State; member.Address = icmb.Address; member.City = icmb.City; member.DOB = icmb.DOB; member.Email = icmb.Email; member.Phone = icmb.Phone; member.PostalCode = icmb.PostalCode; member.DateRegistered = icmb.DateRegistered; member.AmountPaid = icmb.AmountPaid; member.IsDeleted = icmb.IsDeleted; db.Entry(member).State = EntityState.Modified; db.SaveChanges(); //Remove all existing family details for this member db.FamilyMembers.RemoveRange(db.FamilyMembers.Where(m => m.IcomMembersId == member.IcomMembersId)); db.SaveChanges(); icmb.Family = icmb.Family.Concat(new List <FamilyViewModel>() { new FamilyViewModel { FamilyDOB = member.DOB, FamilyFullName = member.FullName, IncIndex = 1, IsPrimary = true } }); //Save new Family member details for this member SaveFamilies(icmb.IcomMembersId, icmb.Family.ToList()); return(RedirectToAction("Index")); } return(View(icmb)); }