public void Delete_Arrange() { Workcenter workcenter = listWorkcenter[id]; mock.Setup(a => a.Get(id)).Returns(workcenter); mock.Setup(a => a.Delete(id)); }
public ActionResult Edit(int id) { WorkcenterDTO workcenterDto = new WorkcenterDTO(); try { Workcenter workcenter = workcenterCrudService.Get(id); if (workcenter == null) { logger.Error($"HttpNotFound! Url:{System.Web.HttpContext.Current.Request.UrlReferrer}"); //Dictionary<string, string> statys = new Dictionary<string, string> //{ // ["statys"] = "HttpNotFound" //}; //return Json(statys, JsonRequestBehavior.AllowGet); return(HttpNotFound()); } else { workcenterDto = AutoMapperWebUtil.WorkcenterEntitiesToDto(workcenter); } } catch (ValidationException ex) { ControllerExtension.ActionsOnException(logger, ex, ModelState); return(Json(ex, JsonRequestBehavior.AllowGet)); } // workcenterViewModel.ModelState = this.ModelState; return(Json(workcenterDto, JsonRequestBehavior.AllowGet)); }
public void AddPostAction_Arrange() { // Arrange Workcenter workcenter = listWorkcenter[2]; mock.Setup(a => a.Add(workcenter)).Returns(workcenter.Id); }
protected void SetUp() { Test test = new Test("Default", 0, 0, 0, 0, 0); Configuration.Initialize(test); _workorder = Substitute.For <IWork>(); _workorder.CurrentOpType.Returns(Op.OpTypes.DrillOpType1); _workorder.CurrentOpSetupTime.Returns(0); _workorder.CurrentOpEstTimeToComplete.Returns(1); _workorder.Id.Returns(1); ISchedulePlants ps = Substitute.For <ISchedulePlants>(); ps.ValidateWoForMachines(Arg.Any <int>(), Arg.Any <string>()).Returns(x => x[0]); _plant = Substitute.For <IPlant>(); _plant.PlantScheduler.Returns(ps); _bigData = Substitute.For <IHandleBigData>(); _bigData.IsBreakdown(Arg.Any <string>(), Arg.Any <DayTime>()).Returns(x => x[1]); _bigData.IsNonConformance(Arg.Any <string>()).Returns(false); _mes = Substitute.For <IMes>(); _dayTime = new DayTime(); _subject = new Workcenter("TestWC", Machine.Types.BigDrill); _subject.SetMes(_mes); _subject.AddPlant(_plant); _subject.AddBigData(_bigData); }
public ActionResult DeleteConfirmed(string id) { Workcenter workcenter = db.Workcenters.Find(id); db.Workcenters.Remove(workcenter); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "WorkCenterID,WorkCenterLocation")] Workcenter workcenter) { if (ModelState.IsValid) { db.Entry(workcenter).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workcenter)); }
public ActionResult Create([Bind(Include = "WorkCenterID,WorkCenterLocation")] Workcenter workcenter) { if (ModelState.IsValid) { db.Workcenters.Add(workcenter); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workcenter)); }
// GET: Workcenters/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Workcenter workcenter = db.Workcenters.Find(id); if (workcenter == null) { return(HttpNotFound()); } return(View(workcenter)); }
protected override void Seed(EFPlantContext db) { #region Add Workcenter var workcenter_dal = new Workcenter { Name = "PlantApp.DAL.UI" }; var workcenter_bll = new Workcenter { Name = "BLL" }; var workcenter_web = new Workcenter { Name = "Web" }; var workcenter_ui = new Workcenter { Name = "UI" }; db.Workcenters.AddRange(new Workcenter[] { workcenter_ui, workcenter_web, workcenter_bll, workcenter_dal }); #endregion }
public ActionResult DeleteWorkcenter(int id) { Workcenter workcenter = workcenterCrudService.Get(id); try { if (workcenter != null) { workcenterCrudService.Delete(id); } else { return(HttpNotFound()); } } catch (ValidationException ex) { ControllerExtension.ActionsOnException(logger, ex, ModelState); return(Json(ex, JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { WorkcenterDTO workcenterDto; Workcenter workcenter = workcenterCrudService.Get(id); try { if (workcenter == null) { return(HttpNotFound()); } else { workcenterDto = AutoMapperWebUtil.WorkcenterEntitiesToDto(workcenter); } } catch (ValidationException ex) { ControllerExtension.ActionsOnException(logger, ex, ModelState); return(Json(ex, JsonRequestBehavior.AllowGet)); } return(Json(workcenterDto, JsonRequestBehavior.AllowGet)); }
public void EditGetAction_Arrange() { Workcenter workcenter = listWorkcenter[id]; mock.Setup(a => a.Get(id)).Returns(workcenter); }
public static WorkcenterDTO WorkcenterEntitiesToDto(Workcenter workcenter) { var mapper = new MapperConfiguration(cfg => cfg.CreateMap <Workcenter, WorkcenterDTO>()).CreateMapper(); return(mapper.Map <Workcenter, WorkcenterDTO>(workcenter)); }