public ActionResult Edit(TradeMarkVM model) { if (ModelState.IsValid) { var trademark = rptrademark.FirstOrDefault(x => (x.Name.ToLower() == model.Name.ToLower() || x.BarcodeValue == model.BarcodeValue) && x.ID != model.ID); if (trademark != null) { ViewBag.IslemDurum = trademark.Name.ToLower() == model.Name.ToLower() ? EnumIslemDurum.IsimMevcut : EnumIslemDurum.BarkodMevcut; } else { TradeMark entity = rptrademark.Find(model.ID); entity.Name = model.Name; entity.BarcodeValue = model.BarcodeValue; entity.UpdateDate = DateTime.Now; rptrademark.SaveChanges(); ViewBag.IslemDurum = EnumIslemDurum.Basarili; } } else { ViewBag.IslemDurum = EnumIslemDurum.ValidationHata; } return(View(model)); }
public async Task <ActionResult <TradeMark> > PostTradeMark(TradeMark tradeMark) { _context.TradeMark.Add(tradeMark); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTradeMark", new { id = tradeMark.TradeMarkId }, tradeMark)); }
public ActionResult Add(TradeMarkVM model) { if (ModelState.IsValid) { var trademark = rptrademark.FirstOrDefault(x => x.Name.ToLower() == model.Name.ToLower() || x.BarcodeValue == model.BarcodeValue); if (trademark != null) { ViewBag.IslemDurum = trademark.Name.ToLower() == model.Name.ToLower() ? EnumIslemDurum.IsimMevcut : EnumIslemDurum.BarkodMevcut; } else { TradeMark entity = new TradeMark { Name = model.Name, BarcodeValue = model.BarcodeValue }; rptrademark.Add(entity); ViewBag.IslemDurum = EnumIslemDurum.Basarili; } } else { ViewBag.IslemDurum = EnumIslemDurum.ValidationHata; } return(View(model)); }
public async Task <IActionResult> PutTradeMark(int id, TradeMark tradeMark) { if (id != tradeMark.TradeMarkId) { return(BadRequest()); } _context.Entry(tradeMark).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TradeMarkExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private TradeMarkModel TradeMarktoTradeMarkModel(TradeMark tm) { var tmModel = new TradeMarkModel(); tmModel.IDTradeMark = tm.IDTradeMark; tmModel.Name = tm.Name; tmModel.IDCategory = tm.IDCategory; return(tmModel); }
public ActionResult AddTradeMark(TradeMarkModel tmModel) { var trademark = new TradeMark(); trademark.Name = tmModel.Name; TradeMarkDAO tmdao = new TradeMarkDAO(); tmdao.UpdateTradeMark(trademark); return(RedirectToAction("Index")); }
protected internal static void GetAutomobileMarks() { try { WebClient WebClient = new WebClient(); string page = WebClient.DownloadString(Url); HtmlDocument Doc = new HtmlDocument(); Doc.LoadHtml(page); var table = Doc.DocumentNode.SelectSingleNode("//table[@class='tck']"); var rows = table.Descendants("tr"); //Parallel.ForEach(rows, node => foreach (var node in rows) { var hrefs = node.SelectNodes(".//a"); var ghre = node.GetAttributeValue("href", "/tech"); string[] array = node.InnerText.Trim().Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length - 1; i++) { TradeMark tradeMark = new TradeMark { TradeMarkName = array[i], TradeMarkUrl = "http://www.autosvit.com.ua/" + hrefs[i].GetAttributeValue("href", "/tech") }; tradeMarks.Add(tradeMark); // db.TradeMarks.Add(tradeMark); // db.SaveChanges(); listOfMarksHrefs.Add(tradeMark.TradeMarkUrl); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public PartialViewResult ActiveProductForCategoryPartial(TradeMark tradeMark) { return(PartialView(tradeMark)); }
public void AddTradeMark(TradeMark tm) { data.TradeMarks.Add(tm); data.SaveChanges(); }
public void UpdateTradeMark(TradeMark tm) { data.TradeMarks.AddOrUpdate(tm); data.SaveChanges(); }