protected override void Seed(SharedDatabaseManagement.DataModel.DolphinContext context) { var client = new Client() { Id = 1, Name = "Doctor Strange", Address = "New York", Mobile = "99999999999", Email = "*****@*****.**", }; var toner = new Toner() { Id = 1, Name = "Epson L800", Client = client, }; var employee = new Employee() { Id = 1, Name = "SpiderMan", Address = "New York", Mobile = "99999999999", Email = "*****@*****.**", }; //context.Clients.AddOrUpdate(client); //context.Toners.AddOrUpdate(toner); //context.Employees.AddOrUpdate(employee); }
// POST: api/Toner public TonerViewModel Post([FromBody] TonerViewModel value) { var toner = Toner.Create(value.Name, value.ClientId); repository.Insert(toner); return(Mapper.Map <TonerViewModel>(toner)); }
public bool isValid(Toner entity) { var validator = new TonerValidator(); var result = validator.Validate(entity); return(result.IsValid); }
public ActionResult DeleteConfirmed(int id) { Toner toner = db.Toners.Find(id); db.Toners.Remove(toner); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /Toner/Delete/5 public ActionResult Delete(int id = 0) { Toner toner = db.Toners.Find(id); if (toner == null) { return(HttpNotFound()); } return(View(toner)); }
public ActionResult Edit(Toner toner) { if (ModelState.IsValid) { db.Entry(toner).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(toner)); }
public ActionResult Edit([Bind(Include = "TonerID,TonerModel,TonerIsOriginal,TonerYield,TonerGram,TonerProductNo,TonerMinQuantity,Created")] Toner toner) { if (ModelState.IsValid) { db.Entry(toner).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(toner)); }
public void Start(IModLoaderV1 loader) { _modLoader = (IModLoader)loader; /* Your mod code starts here. */ _modLoader.GetController <IReloadedHooks>().TryGetTarget(out _hooks); _modLoader.GetController <IPrsInstance>().TryGetTarget(out var _prsInstance); SDK.Init(_hooks, _prsInstance); _toner = new Toner(); }
public ActionResult Create(Toner toner) { if (ModelState.IsValid) { db.Toners.Add(toner); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(toner)); }
public ActionResult Create([Bind(Include = "TonerID,TonerModel,TonerIsOriginal,TonerYield,TonerProductNo,TonerGram,Created")] Toner toner) { if (ModelState.IsValid) { db.Toners.Add(toner); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(toner)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Toner toner = db.Toners.Find(id); if (toner == null) { return(HttpNotFound()); } return(View(toner)); }
public IList <ErrorMessage> Errors(Toner entity) { var validator = new TonerValidator(); var result = validator.Validate(entity); var errors = new List <ErrorMessage>(); foreach (var item in result.Errors) { errors.Add(new ErrorMessage { Key = item.PropertyName, Error = item.ErrorMessage }); } return(errors); }
public void Remove(Toner entity) { _repository.Remove(entity); }
public void Update(Toner entity) { _repository.Update(entity); }
public Toner Find(Toner entity) { return(_repository.Find(entity)); }
public void Add(Toner entity) { _repository.Add(entity); }