public ActionResult UpdateContact(ContactViewModel model) { if (model.Id_Contact > 0) { contact = db.ContactUs.SingleOrDefault(x => x.Id_Contact == model.Id_Contact); contact.Id_Contact = model.Id_Contact; contact.Address = model.Address; contact.Phone = model.Phone; contact.Email = model.Email; db.SaveChanges(); } else { contact.Address = model.Address; contact.Phone = model.Phone; contact.Email = model.Email; db.ContactUs.Add(contact); db.SaveChanges(); } var response = true; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(PortofolioViewModel model) { Category category = new Category(); category.Category_Name = model.Category_Name; db.Categories.Add(category); db.SaveChanges(); var response = true; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult AddSkill(SkillViewModel model) { if (ModelState.IsValid == true) { skill.Skill_Name = model.Skill_Name; skill.Skill_Value = model.Skill_Value; db.Skills.Add(skill); db.SaveChanges(); } var response = true; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateProfile(ProfileViewModel model) { if (model.Id_User > 0) { User usr = db.Users.SingleOrDefault(x => x.Id_User == model.Id_User); usr.Id_User = model.Id_User; usr.Full_Name = model.Full_Name; usr.Email = model.Email; usr.password = model.password; db.SaveChanges(); } var response = true; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(ServiceViewModel model) { YelCreativeEntities db = new YelCreativeEntities(); if (model.Id_Service > 0) { try { Service service = db.Services.SingleOrDefault(x => x.Id_Service == model.Id_Service); service.Id_Service = model.Id_Service; service.Service_Name = model.Service_Name; service.Content_Service = model.Content_Service; db.SaveChanges(); } catch (DbEntityValidationException ex) { foreach (var entityValidationErrors in ex.EntityValidationErrors) { foreach (var validationError in entityValidationErrors.ValidationErrors) { Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage); } } } } else { Service service = new Service(); service.Id_Service = model.Id_Service; service.Service_Name = model.Service_Name; service.Content_Service = model.Content_Service; db.Services.Add(service); db.SaveChanges(); } var response = true; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteService(int Id_Service) { YelCreativeEntities db = new YelCreativeEntities(); Service service = db.Services.Find(Id_Service); db.Services.Remove(service); db.SaveChanges(); var response = true; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(AboutViewModel model) { YelCreativeEntities db = new YelCreativeEntities(); if (ModelState.IsValid == true) { AboutU ab = db.AboutUs.SingleOrDefault(x => x.Id_About == model.Id_About); ab.Id_About = model.Id_About; ab.Content_About = model.Content_About; ab.Update_Date = DateTime.Now; db.SaveChanges(); } var response = true; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateAboutMe(AboutViewModel model) { YelCreativeEntities db = new YelCreativeEntities(); AboutU ab = db.AboutUs.SingleOrDefault(x => x.Id_About == model.Id_About); ab.Current_Position = model.Current_Position; ab.City = model.City; ab.Age = model.Age; ab.Birthday = model.Birthday; ab.Degree = model.Degree; db.SaveChanges(); var response = true; return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult AddRole(DashboardsViewModel model) { Role role = new Role(); role.Role_Name = model.Role_Name; db.Roles.Add(role); db.SaveChanges(); var response = true; return(Json(response, JsonRequestBehavior.AllowGet)); }