public ActionResult GetTram(string Id) { var listTram = new List <DMTRAM>(); var dataListTram = db.DMTUYENCHITIETTRAMs.Where(x => x.IDTUYEN == db.DMTUYENs.FirstOrDefault(y => y.IDTUYEN == Id).MATUYEN).ToList(); var tram = db.DMTRAMs.ToList(); foreach (var item in dataListTram) { var listT = new DMTRAM(); listT.MATRAM = item.MATRAM; listT.TENTRAM = db.DMTRAMs.FirstOrDefault(x => x.MATRAM == item.MATRAM).TENTRAM; listT.LatLng = db.DMTRAMs.FirstOrDefault(x => x.MATRAM == item.MATRAM).LatLng; listTram.Add(listT); } var dataAll = new AllModel { TblDMTUYEN = db.DMTUYENs.FirstOrDefault(x => x.IDTUYEN == Id), ListDMTUYENCHITIETTRAM = db.DMTUYENCHITIETTRAMs.Where(x => x.IDTUYEN == db.DMTUYENs.FirstOrDefault(y => y.IDTUYEN == Id).MATUYEN).ToList(), ListDMTRAM = listTram }; return(Json(new { result = dataAll })); }
public virtual ActionResult Index() { var model = new AllModel(); var ListUser = RESTHelper.Get <ResultModel <List <UsersModel> > >(ConfigurationManager.AppSettings["HostAPIURL"] + ConfigurationManager.AppSettings["GetAllUser"]); var ListCatalogue = RESTHelper.Get <ResultModel <List <CatalogueModel> > >(ConfigurationManager.AppSettings["HostAPIURL"] + ConfigurationManager.AppSettings["GetAllCatalague"]); var ListInvoice = RESTHelper.Get <ResultModel <List <InvoiceModel> > >(ConfigurationManager.AppSettings["HostAPIURL"] + ConfigurationManager.AppSettings["GetAllInvoice"]); ViewBag.NoInvoice = RESTHelper.Get <ResultModel <string> >(ConfigurationManager.AppSettings["HostAPIURL"] + ConfigurationManager.AppSettings["GenerateNoInvoice"]); if (ListCatalogue != null) { model.ListCatalogues = ListCatalogue.Value; } if (ListInvoice != null) { model.ListInvoices = ListInvoice.Value; } if (ListUser != null) { model.ListUsers = ListUser.Value; } if (TempData.ContainsKey("StatusMessage")) { ViewBag.Message = TempData["StatusMessage"]; } return(View(model)); }
// GET: DmHoaDon/Edit/5 public ActionResult Edit(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var dataTaiXe = db.DMXEs.ToList(); dataTaiXe.Insert(0, new DMXE { MAXE = "", SOXE = "Chọn số xe" }); DMHOADON dMHOADON = db.DMHOADONs.Find(id); if (dMHOADON == null) { return(HttpNotFound()); } var model = new AllModel { ListDmXe = dataTaiXe, DmHoaDon = dMHOADON }; return(View(model)); }
public ActionResult UserMain(int?p) { dbDemoDataContext db = new dbDemoDataContext(); tCustomer customer = (new dbDemoDataContext()).tCustomer.FirstOrDefault(m => m.fId == p); customer = Session[CDictionary.LOGIN_USER] as tCustomer; Timer timer = new Timer(5000); timer.AutoReset = true; timer.Enabled = true; if (customer != null) { ViewBag.Id = customer.fId.ToString() + ".jpg"; ViewBag.Name = customer.fName; ViewBag.Phone = customer.fPhone; ViewBag.Email = customer.fEmail; ViewBag.Address = customer.fAddress; AllModel all = new AllModel(); return(View(all)); } else { return(RedirectToAction("../Home/Index")); } }
// GET: DmXe/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DMXE dMXE = db.DMXEs.Find(id); if (dMXE == null) { return(HttpNotFound()); } var dataTaiXe = db.DMTAIXEs.ToList(); dataTaiXe.Insert(0, new DMTAIXE { MATAIXE = "", TENTAIXE = "Chọn tài xế" }); var model = new AllModel { DmXe = dMXE, ListDmTaiXe = dataTaiXe }; return(View(model)); }
public ActionResult EditManyAttribute(AllModel allModel) { var branchId = 0; try { branchId = allModel.factor[0].BranchId; foreach (var factor in allModel.factor) { var fc = db.Factors.Find(factor.Id); fc.FactorName = factor.FactorName; fc.Weight = factor.Weight; } foreach (var criteria in allModel.criteria) { var cr = db.Criterias.Find(criteria.Id); cr.CriteriaName = criteria.CriteriaName; cr.Weight = criteria.Weight; } foreach (var attribute in allModel.attribute) { var at = db.Attributes.Find(attribute.Id); at.AttributeName = attribute.AttributeName; at.Weight = attribute.Weight; } db.SaveChanges(); return(RedirectToAction("Edit", "Branch", new { branchId = branchId })); } catch (Exception ex) { return(View()); } }
public ActionResult Create(AllModel model) { try { if (model.tblVocabularyArray != null) { foreach (var item in model.tblVocabularyArray) { var check = db.vocabularies.FirstOrDefault(x => x.code == item.code); if (check == null) { db.vocabularies.Add(item); } } } db.SaveChanges(); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } } return(RedirectToAction("Index")); }
public ActionResult EditCriteria(int branchId, int factorId, int criteriaId) { var model = new AllModel(); var factors = from factor in db.Factors where factor.FactorId.Equals(factorId) select factor; foreach (var fa in factors) { model.factor.Add(fa); } var criterias = from criteria in db.Criterias where criteria.CriteriaId.Equals(criteriaId) select criteria; foreach (var criteria in criterias) { model.criteria.Add(criteria); } var attributes = from attribute in db.Attributes where attribute.CriteriaId.Equals(criteriaId) select attribute; foreach (var attribute in attributes) { model.attribute.Add(attribute); } return(View(model)); }
public ActionResult PartialViewFactor(int id = 0) { var model = new AllModel(); var branchId = (from branch in db.Branchs where branch.BranchId == id select branch.BranchId).FirstOrDefault(); var factors = db.Factors.Where(x => x.BranchId == id).OrderByDescending(x => x.Weight); foreach (var fa in factors) { model.factor.Add(fa); } var criterias = db.Criterias.Where(x => x.BranchId == id).OrderByDescending(x => x.Weight); foreach (var criteria in criterias) { model.criteria.Add(criteria); } var attributes = db.Attributes.Where(x => x.BranchId == id).OrderByDescending(x => x.Weight); foreach (var attribute in attributes) { model.attribute.Add(attribute); } return(PartialView("PartialViewFactor", model)); }
public ActionResult CreateProduct(AllModel model, HttpPostedFileBase[] files) { if (ModelState.IsValid) { var _tblProduct = new tblProduct(); _tblProduct = model.TblProduct; _tblProduct.CreateDateProducts = DateTime.Now; db.tblProducts.Add(_tblProduct); db.SaveChanges(); if (files != null && files.Length > 0) { for (int i = 0; i < files.Length; i++) { if (files[i] != null) { byte[] binaryData; binaryData = new Byte[files[i].InputStream.Length]; long bytesRead = files[i].InputStream.Read(binaryData, 0, (int)files[i].InputStream.Length); files[i].InputStream.Close(); string base64String = System.Convert.ToBase64String(binaryData, 0, binaryData.Length); SaveImg(new PictureModel { nameImg = files[i].FileName, idProducts = model.TblProduct.IdProducts, isactive = 1, index = i, cfile = base64String }); } } } return(RedirectToAction("IndexProduct")); } return(View(model.TblProduct)); }
public ActionResult Search(string search) { //trả về kết quả khi tìm kiếm được var tacgia = db.TacGias.Where(x => x.TenTacGia.Contains(search)); var album = db.Albums.Include(s => s.TacGia).Where(x => x.TenAlbum.Contains(search)); AllModel allModel = new AllModel { TacGias = tacgia.ToList(), Albums = album.ToList(), }; //khi chưa nhập từ khóa mà nhấn search => trả về danh sách rỗng var tacgianull = db.TacGias.Where(x => x.TacGiaID < 0); var albumnull = db.Albums.Include(s => s.TacGia).Where(x => x.AlbumID < 0); AllModel allModelnull = new AllModel { TacGias = tacgianull.ToList(), Albums = albumnull.ToList(), }; ViewBag.Title = search; if (search == "") { return(View(allModelnull)); } else { ViewBag.countTacgia = tacgia.Count(); ViewBag.countAlbum = album.Count(); ViewBag.SumCount = tacgia.Count() + album.Count(); return(View(allModel)); } }
public ActionResult Edit(AllModel model, HttpPostedFileBase[] inputfile) { if (model.tblProductArray != null) { foreach (var item in model.tblProductArray) { var tem = db.items.Find(item.ARTNO); tem.WEBPRICE = model.tblitem.WEBPRICE; tem.CATEGORYNO = model.tblitem.CATEGORYNO; tem.ARTNAME = item.ARTNAME; tem.GROUPNO = model.tblitem.GROUPNO; tem.INFO = item.INFO; tem.IsBestSeller = model.tblitem.IsBestSeller; tem.WEBPRICE = item.WEBPRICE; tem.EXPORTABLE = model.tblitem.EXPORTABLE; tem.STOCKITEM = model.tblitem.STOCKITEM; tem.SPECIALOFFER = model.tblitem.SPECIALOFFER; tem.AUTHORIZABLE = model.tblitem.AUTHORIZABLE; tem.RESTRICTED = model.tblitem.RESTRICTED; tem.NOTPOST = model.tblitem.NOTPOST; tem.NOTADDPOSTAGEFEE = model.tblitem.NOTADDPOSTAGEFEE; tem.WIDTH = model.tblitem.WIDTH; tem.WEIGHT = model.tblitem.WEIGHT; tem.HEIGHT = model.tblitem.HEIGHT; tem.LEN = model.tblitem.LEN; db.Entry(tem).State = EntityState.Modified; if (inputfile != null) { for (int i = 0; i < inputfile.Length; i++) { if (inputfile[i] != null) { string path = ""; path = Path.Combine(Server.MapPath("/Content/ProductImage"), Path.GetFileName(inputfile[i].FileName)); var picId = db.artlinks.OrderByDescending(x => x.LINENO).FirstOrDefault(); inputfile[i].SaveAs(path); var tblPic = new artlink { LINENO = picId.LINENO + 1, ARTNO = item.ARTNO, LASTCHANGE = DateTime.Now, CREATED = DateTime.Now, LINK = inputfile[i].FileName }; db.artlinks.Add(tblPic); } } } } } db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(AllModel model, HttpPostedFileBase[] files) { if (ModelState.IsValid) { db.Entry(model.tblStock).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(model.tblStock)); }
public ActionResult CreateGroup(AllModel model, HttpPostedFileBase[] inputfile) { if (model.tblGroupArray != null) { var groupF = new artgrp(); groupF.METAGROUPNO = model.tblGroup.METAGROUPNO; groupF.IsActive = model.tblGroup.IsActive; groupF.CREATED = DateTime.Now; groupF.LASTCHANGE = DateTime.Now; groupF.EXPORTABLE = "T"; groupF.CodeLanguage = model.tblGroupArray[0].CodeLanguage.ToLower(); groupF.GROUPCODE = model.tblGroupArray[0].GROUPCODE; groupF.GROUPNAME = model.tblGroupArray[0].GROUPNAME; db.artgrps.Add(groupF); db.SaveChanges(); var updategroupF = db.artgrps.Find(groupF.GROUPNO); updategroupF.IdCurrentItem = groupF.GROUPNO; db.Entry(updategroupF).State = EntityState.Modified; db.SaveChanges(); foreach (var item in model.tblGroupArray.Skip(1).ToList()) { item.METAGROUPNO = model.tblGroup.METAGROUPNO; item.IsActive = model.tblGroup.IsActive; item.CREATED = DateTime.Now; item.LASTCHANGE = DateTime.Now; item.EXPORTABLE = "T"; item.IdCurrentItem = groupF.IdCurrentItem; db.artgrps.Add(item); } db.SaveChanges(); if (inputfile != null) { for (int i = 0; i < inputfile.Length; i++) { if (inputfile[i] != null) { var fname = "" + "." + inputfile[i].FileName.Split('.').Last(); string path = Server.MapPath("~/Content/MetagroupImage"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path = Path.Combine(path + "/", fname); inputfile[i].SaveAs(path); } } } } return(RedirectToAction("IndexGroup")); }
// GET: LoTrinhChoXe/Create public ActionResult Create() { var all = new AllModel { ListDmXe = db.DMXEs.ToList(), ListDMTUYEN = db.DMTUYENs.ToList(), ListDmTaiXe = db.DMTAIXEs.ToList(), }; return(View(all)); }
public ActionResult Edit(AllModel allModel) { try { // TODO: Add update logic here return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult AccountInfo(AllModel model) { var user = db.users.Find(model.tblUser.Id); if (user != null) { ViewBag.Notification = 0; user.updatedate = DateTime.Now; user.display = model.tblUser.display; user.email = model.tblUser.email; db.Entry(user).State = EntityState.Modified; db.SaveChanges(); var userdata = db.userdatas.Find(model.tblUserData.Id); if (userdata != null) { userdata.firstname = model.tblUserData.firstname; userdata.lasname = model.tblUserData.lasname; userdata.contact_email = model.tblUserData.contact_email; userdata.contact_phone = model.tblUserData.contact_phone; userdata.company_name = model.tblUserData.company_name; userdata.delivery_name = model.tblUserData.delivery_name; userdata.delivery_email = model.tblUserData.delivery_email; userdata.delivery_phone = model.tblUserData.delivery_phone; userdata.delivery_address1 = model.tblUserData.delivery_address1; userdata.delivery_address2 = model.tblUserData.delivery_address2; userdata.delivery_suburb = model.tblUserData.delivery_suburb; userdata.delivery_postcode = model.tblUserData.delivery_postcode; userdata.delivery_state = model.tblUserData.delivery_state; userdata.delivery_contry = model.tblUserData.delivery_contry; userdata.billing_name = model.tblUserData.billing_name; userdata.billing_email = model.tblUserData.billing_email; userdata.billing_phone = model.tblUserData.billing_phone; userdata.billing_address1 = model.tblUserData.billing_address1; userdata.billing_address2 = model.tblUserData.billing_address2; userdata.billing_suburb = model.tblUserData.billing_suburb; userdata.billing_poscode = model.tblUserData.billing_poscode; userdata.billing_state = model.tblUserData.billing_state; userdata.billing_country = model.tblUserData.billing_country; db.Entry(userdata).State = EntityState.Modified; db.SaveChanges(); ViewBag.Notification = 1; } else { ViewBag.Notification = 0; } } return(View(model)); }
private void DeleteModel(GroupCharacterViewModel model) { if (model == null) return; if (MessageBoxWPF.Show("Вы действительно хотите удалить параметр ?", StringProject.MessageCaption, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) return; bool flag = repository.DeleteGroupCharacter(model.GetModel); if (!flag) { MessageBoxWPF.Show(StringProject.ErrorDelRecort, StringProject.ErrorCaption, MessageBoxButton.OK, MessageBoxImage.Error); return; } AllModel.Remove(model); }
public ActionResult Create(AllModel model, HttpPostedFileBase[] inputfile) { if (model.tblStoreArray != null) { var storeF = new store { CodeLanguage = model.tblStoreArray[0].CodeLanguage.ToLower(), Name = model.tblStoreArray[0].Name, Location = model.tblStoreArray[0].Location, Description = model.tblStoreArray[0].Description }; db.stores.Add(storeF); db.SaveChanges(); var updateItem = db.stores.Find(storeF.Id); updateItem.IdCurrentItem = storeF.Id; db.Entry(updateItem).State = EntityState.Modified; db.SaveChanges(); foreach (var item in model.tblStoreArray.Skip(1).ToList()) { var tblStore = new store { CodeLanguage = item.CodeLanguage.ToLower(), IdCurrentItem = storeF.IdCurrentItem, Name = item.Name, Location = item.Location, Description = item.Description, }; db.stores.Add(tblStore); } if (inputfile != null) { for (int i = 0; i < inputfile.Length; i++) { if (inputfile[i] != null) { string path = ""; path = Path.Combine(Server.MapPath("/Content/ProductImage"), Path.GetFileName(inputfile[i].FileName)); inputfile[i].SaveAs(path); updateItem.UrlImage = "/Content/ProductImage/" + inputfile[i].FileName; } } } db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult EditProduct(AllModel model, HttpPostedFileBase[] files, int[] imgId) { var tblProduct = db.tblProducts.Find(model.TblProduct.IdProducts); tblProduct.CodeProducts = model.TblProduct.CodeProducts; tblProduct.IdCategoryProducts = model.TblProduct.IdCategoryProducts; tblProduct.IdCompany = model.TblProduct.IdCompany; tblProduct.DescriptionProducts = model.TblProduct.DescriptionProducts; tblProduct.DescriptionProducts_en = model.TblProduct.DescriptionProducts_en; tblProduct.ShortDesProducts = model.TblProduct.ShortDesProducts; tblProduct.ShortDesProducts_en = model.TblProduct.ShortDesProducts_en; tblProduct.IdTypeProducts = model.TblProduct.IdTypeProducts; tblProduct.NameProducts = model.TblProduct.NameProducts; tblProduct.NameProducts_en = model.TblProduct.NameProducts_en; tblProduct.StatusProducts = model.TblProduct.StatusProducts; tblProduct.ModifiDateProducts = DateTime.Now; db.Entry(tblProduct).State = EntityState.Modified; db.SaveChanges(); if (files != null && files.Length > 0) { if (imgId != null && imgId.Length > 0) { var listPic = db.tblPictures.Where(T => T.ProductsId == model.TblProduct.IdProducts && !imgId.Contains(T.PictureId)).ToList(); foreach (var pic in listPic) { db.Entry(pic).State = EntityState.Deleted; } } for (int i = 0; i < files.Length; i++) { if (files[i] != null) { byte[] binaryData; binaryData = new Byte[files[i].InputStream.Length]; long bytesRead = files[i].InputStream.Read(binaryData, 0, (int)files[i].InputStream.Length); files[i].InputStream.Close(); string base64String = System.Convert.ToBase64String(binaryData, 0, binaryData.Length); SaveImg(new PictureModel { nameImg = files[i].FileName, idProducts = model.TblProduct.IdProducts, isactive = 1, index = i, cfile = base64String }); } } } db.SaveChanges(); return(RedirectToAction("IndexProduct")); }
public ActionResult EditCategory(int id) { var listMenu = db.tblMenus.ToList(); listMenu.Insert(0, new tblMenu { IdMenu = 0, NameMenu = "Chọn menu" }); var data = new AllModel { TblMenu = db.tblMenus.FirstOrDefault(x => x.IdMenu == id), ListMenu = listMenu }; return(View(data)); }
// GET: DmXe/Create public ActionResult Create() { var dataTaiXe = db.DMTAIXEs.ToList(); dataTaiXe.Insert(0, new DMTAIXE { MATAIXE = "", TENTAIXE = "Chọn tài xế" }); var model = new AllModel { DmXe = new DMXE(), ListDmTaiXe = dataTaiXe }; return(View(model)); }
public ActionResult CreateCategory() { var listMenu = db.tblMenus.ToList(); listMenu.Insert(0, new tblMenu { IdMenu = 0, NameMenu = "Chọn menu" }); var data = new AllModel { TblMenu = new tblMenu(), ListMenu = listMenu }; return(View(data)); }
public ActionResult CreateMetaGroup(AllModel model, HttpPostedFileBase[] inputfile) { if (model.tblMetaGroupArray != null) { var matagroup = new metagrup(); matagroup.PARENTNO = model.tblMetaGroup.PARENTNO; matagroup.IsActive = model.tblMetaGroup.IsActive; matagroup.CREATED = DateTime.Now; matagroup.METAGROUPNAME = model.tblMetaGroupArray[0].METAGROUPNAME; matagroup.METAGROUPCODE = model.tblMetaGroupArray[0].METAGROUPCODE; matagroup.CodeLanguage = "english"; db.metagrups.Add(matagroup); db.SaveChanges(); var updatematagroup = db.metagrups.Find(matagroup.METAGROUPNO); updatematagroup.IdCurrentItem = matagroup.METAGROUPNO; db.Entry(updatematagroup).State = EntityState.Modified; db.SaveChanges(); foreach (var item in model.tblMetaGroupArray.Skip(1).ToList()) { item.PARENTNO = model.tblMetaGroup.PARENTNO; item.IsActive = model.tblMetaGroup.IsActive; item.CREATED = DateTime.Now; item.IdCurrentItem = updatematagroup.IdCurrentItem; db.metagrups.Add(item); } db.SaveChanges(); if (inputfile != null) { for (int i = 0; i < inputfile.Length; i++) { if (inputfile[i] != null) { var fname = matagroup.IdCurrentItem + "." + inputfile[i].FileName.Split('.').Last(); string path = Server.MapPath("~/Content/MetagroupImage"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path = Path.Combine(path + "/", fname); inputfile[i].SaveAs(path); } } } } return(RedirectToAction("IndexMetaGroup")); }
private void AddModel() { GroupCharacter model = new GroupCharacter(); AddGroupCharacterView view = new AddGroupCharacterView(true, model, repository) { ShowInTaskbar = false }; view.ShowDialog(); if (view.DialogResult != true) return; model.Id = repository.AddGroupCharacter(model); if (model.Id == 0) { MessageBoxWPF.Show(StringProject.ErrorAddRecort, StringProject.ErrorCaption, MessageBoxButton.OK, MessageBoxImage.Error); return; } AllModel.Add(new GroupCharacterViewModel(model)); }
// GET: WebCoin/Edit/5 public ActionResult EditProduct(int?id) { var listMenu = db.tblMenus.ToList(); listMenu.Insert(0, new tblMenu { IdMenu = 0, NameMenu = "Chọn menu" }); var data = new AllModel { TblProduct = db.tblProducts.FirstOrDefault(x => x.IdProducts == id), ListMenu = listMenu, ListPicture = db.tblPictures.Where(x => x.ProductsId == id).ToList() }; return(View(data)); }
public ActionResult Edit(AllModel lOtrinhchoxe) { var tblLotrinh = new LOTRINHCHOXE(); tblLotrinh.CAM = lOtrinhchoxe.Cam == "0" ? false :true; tblLotrinh.KICHHOAT = lOtrinhchoxe.KichHoat == "0" ? false : true; tblLotrinh.IDTUYEN = lOtrinhchoxe.TblLoTrinhXe.IDTUYEN; tblLotrinh.MATAIXE = lOtrinhchoxe.TblLoTrinhXe.MATAIXE; tblLotrinh.MAXE = lOtrinhchoxe.TblLoTrinhXe.MAXE; tblLotrinh.IDLOTRINH = lOtrinhchoxe.TblLoTrinhXe.IDLOTRINH; db.Entry(tblLotrinh).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: DmHoaDon/Create public ActionResult Create() { var dataTaiXe = db.DMXEs.ToList(); dataTaiXe.Insert(0, new DMXE { MAXE = "", SOXE = "Chọn số xe" }); var model = new AllModel { ListDmXe = dataTaiXe, DmHoaDon = new DMHOADON { IDHOADON = 0 } }; return(View(model)); }
public ActionResult ApiCreateProduct(AllModel model) { var _tblProduct = new tblProduct(); _tblProduct = model.TblProduct; _tblProduct.CreateDateProducts = DateTime.Now; db.tblProducts.Add(_tblProduct); db.SaveChanges(); var webClient = new WebClient(); var imageBytes = webClient.DownloadData(model.UrlImg); string base64String = System.Convert.ToBase64String(imageBytes, 0, imageBytes.Length); SaveImg(new PictureModel { nameImg = "", idProducts = model.TblProduct.IdProducts, isactive = 1, index = 1, cfile = base64String }); return(Json(model.TblProduct)); }
public ActionResult EditCategory(AllModel model) { var dataMenu = db.tblMenus.Find(model.TblMenu.IdMenu); dataMenu.NameMenu = model.TblMenu.NameMenu; dataMenu.NameMenu_en = model.TblMenu.NameMenu_en; dataMenu.IdCompany = model.TblMenu.IdCompany; dataMenu.IsCategoryMenu = model.TblMenu.IsCategoryMenu; dataMenu.IsParent = model.TblMenu.IsParent; dataMenu.ShowHomeMenu = model.TblMenu.ShowHomeMenu; dataMenu.StatusMenu = model.TblMenu.StatusMenu; dataMenu.LinkMenu = model.TblMenu.LinkMenu; dataMenu.IdParentMenu = model.TblMenu.IdParentMenu; db.Entry(dataMenu).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("IndexCategory")); }