// GET: Portfolio_CustomerRequest/Create public ActionResult CustomerProcess(int?id) { AddItemDropDownList(); if (id == null) { return(View()); } else { var sorgu = db.Portfilio_CustomerRequest.Where(x => x.Id == id).FirstOrDefault(); CustomerModelView cusw = new CustomerModelView(); cusw.cr_Land = sorgu.Land; cusw.cr_Office = sorgu.Office; cusw.cr_Status = sorgu.Status; cusw.cr_Transformation = sorgu.Transformation; cusw.cr_City = sorgu.City; cusw.cr_Country = sorgu.Country; cusw.cr_FinishDate = sorgu.FinishDate; cusw.cr_FloorChange = sorgu.FloorChange; cusw.cr_Housing = sorgu.Housing; cusw.cr_MaxArea = sorgu.MaxArea; cusw.cr_MaxPrice = sorgu.MaxPrice; cusw.cr_MinArea = sorgu.MinArea; cusw.cr_MinPrice = sorgu.MinPrice; cusw.cr_Note = sorgu.Note; cusw.c_Id = sorgu.C_Id; return(View(cusw)); } return(View()); }
public ActionResult Show() { CustomerModelView customerVm = new CustomerModelView(); customerVm.Customers = customerManager.GetAll(); return(View(customerVm)); }
public ActionResult Delete(int Id) { CustomerModelView customerVm = new CustomerModelView(); Customer customer = new Customer(); customer = customerManager.GetById(Id); customerVm = Mapper.Map <CustomerModelView>(customer); return(View(customerVm)); }
public ActionResult CreateCustomer(CustomerModelView USV) { if (ModelState.IsValid) { JobManager UM = new JobManager(); UM.AddCustomer(USV); } return(View()); // return RedirectToAction("Create","Job"); }
// GET: Customer/Edit/5 public ActionResult Edit(int id) { var customer = ComicDB.GetCustomer(id); var viewmodel = new CustomerModelView { Id = customer.CustomerId, Name = customer.Name, Email = customer.Email, StoreId = customer.StoreId }; return(View(viewmodel)); }
public ActionResult Edit(CustomerModelView customerVm) { if (ModelState.IsValid) { var customer = Mapper.Map <Customer>(customerVm); if (customerManager.Update(customer)) { ViewBag.SuccessMsg = "Updated"; } else { ViewBag.FailMsg = "Failed"; } } else { ViewBag.FailMsg = "Upps!Something Wrong"; } return(View(customerVm)); }
public ActionResult Create(CustomerModelView customer) { try { var cust = new ET.ComicStore.Library.Customer { Name = customer.Name, Email = customer.Email, StoreId = customer.StoreId }; ComicDB.AddCustomer(cust); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Edit(int id, CustomerModelView customer) { try { var cust = new Customer { CustomerId = id, Name = customer.Name, Email = customer.Email, StoreId = customer.StoreId }; ComicDB.UpdateCustomer(cust); return(RedirectToAction(nameof(Index))); } catch { return(View(customer)); } }
public void AddCustomer(CustomerModelView user) { using (SchedulerEntities db = new SchedulerEntities()) { CUSTOMER CU = new CUSTOMER(); CU.CreatedBy = HttpContext.Current.User.Identity.Name; CU.LastModifiedBy = HttpContext.Current.User.Identity.Name; CU.CreationDate = DateTime.Now; CU.ID = Guid.NewGuid(); CU.Firstname = user.Firstname; CU.Lastname = user.Lastname; CU.Address = user.Address; CU.Email = user.Email; CU.Mobile = user.Mobile; CU.Notes = user.Notes; db.CUSTOMERs.Add(CU); db.SaveChanges(); } }
public ActionResult Show(CustomerModelView customerVm) { var customers = customerManager.GetAll(); if (customerVm.Code != null) { customers = customers.Where(c => c.Code.ToLower().Contains(customerVm.Code.ToLower())).ToList(); } if (customerVm.CustomerName != null) { customers = customers.Where(c => c.CustomerName.ToLower().Contains(customerVm.CustomerName.ToLower())).ToList(); } if (customerVm.Email != null) { customers = customers.Where(c => c.Email.ToLower().Contains(customerVm.Email.ToLower())).ToList(); } customerVm.Customers = customers; return(View(customerVm)); }
public ActionResult Delete(CustomerModelView customerVm) { if (ModelState.IsValid) { var cutomer = Mapper.Map <Customer>(customerVm); if (customerManager.Delete(cutomer)) { ViewBag.SuccessMsg = "Deleted!"; } else { ViewBag.ErrorMsg = "Failed!"; } } else { ViewBag.ErrorMsg = "Validation!"; } return(RedirectToAction("Show", "Customer")); }
public ActionResult Add() { CustomerModelView customerVm = new CustomerModelView(); return(View(customerVm)); }
public ActionResult CustomerProcess(CustomerModelView customer) { if (ModelState.IsValid) { if (customer.Id == null) { if (customer.c_Name == null && customer.c_Surname == null) { Portfolio_CustomerRequest pcus = new Portfolio_CustomerRequest(); pcus.City = customer.cr_City; pcus.Country = customer.cr_Country; pcus.FinishDate = customer.cr_FinishDate; pcus.C_Id = customer.c_Id; pcus.FloorChange = customer.cr_FloorChange; pcus.Housing = customer.cr_Housing; pcus.Land = customer.cr_Land; pcus.MaxArea = customer.cr_MaxArea; pcus.MinArea = customer.cr_MinArea; pcus.MaxPrice = customer.cr_MaxPrice; pcus.MinPrice = customer.cr_MinPrice; pcus.Note = customer.cr_Note; pcus.Status = customer.cr_Status; pcus.Office = customer.cr_Office; pcus.Transformation = customer.cr_Transformation; db.Portfilio_CustomerRequest.Add(pcus); db.SaveChanges(); return(RedirectToAction("Index")); } else { Portfolio_Customer cus = new Portfolio_Customer(); cus.Name = customer.c_Name; cus.Surname = customer.c_Surname; cus.EMail = customer.c_EMail; cus.Phone2 = customer.c_Phone2; cus.Phone1 = customer.c_Phone1; db.Portfolio_Customer.Add(cus); db.SaveChanges(); var customerId = db.Portfolio_Customer.Where(x => x.EMail == customer.c_EMail && x.Name == customer.c_Name && x.Surname == customer.c_Surname) .Select(x => x.Id) .FirstOrDefault(); Portfolio_CustomerRequest pcus = new Portfolio_CustomerRequest(); pcus.City = customer.cr_City; pcus.Country = customer.cr_Country; pcus.FinishDate = customer.cr_FinishDate; pcus.C_Id = customerId; pcus.FloorChange = customer.cr_FloorChange; pcus.Housing = customer.cr_Housing; pcus.Land = customer.cr_Land; pcus.MaxArea = customer.cr_MaxArea; pcus.MinArea = customer.cr_MinArea; pcus.MaxPrice = customer.cr_MaxPrice; pcus.MinPrice = customer.cr_MinPrice; pcus.Note = customer.cr_Note; pcus.Status = customer.cr_Status; pcus.Office = customer.cr_Office; pcus.Transformation = customer.cr_Transformation; db.Portfilio_CustomerRequest.Add(pcus); db.SaveChanges(); return(RedirectToAction("Index")); } } else { Portfolio_CustomerRequest pcus = db.Portfilio_CustomerRequest.Where(x => x.Id == customer.Id).FirstOrDefault(); pcus.City = customer.cr_City; pcus.Country = customer.cr_Country; pcus.FinishDate = customer.cr_FinishDate; pcus.C_Id = customer.c_Id; pcus.FloorChange = customer.cr_FloorChange; pcus.Housing = customer.cr_Housing; pcus.Land = customer.cr_Land; pcus.MaxArea = customer.cr_MaxArea; pcus.MinArea = customer.cr_MinArea; pcus.MaxPrice = customer.cr_MaxPrice; pcus.MinPrice = customer.cr_MinPrice; pcus.Note = customer.cr_Note; pcus.Status = customer.cr_Status; pcus.Office = customer.cr_Office; pcus.Transformation = customer.cr_Transformation; db.SaveChanges(); return(RedirectToAction("Index")); } } AddItemDropDownList(); return(View(customer)); }
public ActionResult SaveData(CustomerModelView customer) { return(View()); }