// GET: /ProductMaster/Create public ActionResult Create() { ProductShape vm = new ProductShape(); vm.IsActive = true; return(View("Create", vm)); }
public Blob(string id, string description, long weight, int sides) { this.id = id; this.description = description; this.weight = weight; this.sides = sides; shape = ProductShape.Blob; }
public Cube(string id, string description, long weight, bool isFragile, int sides) { this.id = id; this.description = description; this.weight = weight; this.sides = sides; this.isFragile = isFragile; shape = ProductShape.Cube; }
public Sphere(string id, string description, long weight, bool isFragile, int radius) { this.id = id; this.description = description; this.weight = weight; this.radius = radius; this.isFragile = isFragile; shape = ProductShape.Sphere; }
// GET: /ProductMaster/Edit/5 public ActionResult Edit(int id) { ProductShape pt = _ProductShapeService.Find(id); if (pt == null) { return(HttpNotFound()); } return(View("Create", pt)); }
public Cubeoid(string id, string description, long weight, bool isFragile, int xSide, int ySide, int zSide) { this.id = id; this.description = description; this.weight = weight; this.isFragile = isFragile; this.xSide = xSide; this.ySide = ySide; this.zSide = zSide; shape = ProductShape.Cubeoid; }
// GET: /ProductMaster/Delete/5 public ActionResult Delete(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductShape ProductShape = _ProductShapeService.Find(id); if (ProductShape == null) { return(HttpNotFound()); } ReasonViewModel vm = new ReasonViewModel() { id = id, }; return(PartialView("_Reason", vm)); }
public static I3DStorageObject CreatingNewProduct(ProductShape shape, string id, string description, long weight, bool isFragile, int xside, int yside, int zside) { if (shape.Equals(ProductShape.Cube)) { return(new Cube(id, description, weight, isFragile, xside)); } if (shape.Equals(ProductShape.Sphere)) { return(new Sphere(id, description, weight, isFragile, xside)); } if (shape.Equals(ProductShape.Cubeoid)) { return(new Cubeoid(id, description, weight, isFragile, xside, yside, zside)); } if (shape.Equals(ProductShape.Blob)) { return(new Blob(id, description, weight, xside)); } return(null); }
public ActionResult Post(ProductShape vm) { ProductShape pt = vm; if (ModelState.IsValid) { if (vm.ProductShapeId <= 0) { pt.CreatedDate = DateTime.Now; pt.ModifiedDate = DateTime.Now; pt.CreatedBy = User.Identity.Name; pt.ModifiedBy = User.Identity.Name; pt.ObjectState = Model.ObjectState.Added; _ProductShapeService.Create(pt); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("Create", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.ProductShape).DocumentTypeId, DocId = pt.ProductShapeId, ActivityType = (int)ActivityTypeContants.Added, })); return(RedirectToAction("Create").Success("Data saved successfully")); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); ProductShape temp = _ProductShapeService.Find(pt.ProductShapeId); ProductShape ExRec = Mapper.Map <ProductShape>(temp); temp.ProductShapeName = pt.ProductShapeName; temp.IsActive = pt.IsActive; temp.ModifiedDate = DateTime.Now; temp.ModifiedBy = User.Identity.Name; temp.ObjectState = Model.ObjectState.Modified; _ProductShapeService.Update(temp); LogList.Add(new LogTypeViewModel { ExObj = ExRec, Obj = temp, }); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("Create", pt)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.ProductShape).DocumentTypeId, DocId = temp.ProductShapeId, ActivityType = (int)ActivityTypeContants.Modified, xEModifications = Modifications, })); return(RedirectToAction("Index").Success("Data saved successfully")); } } return(View("Create", vm)); }
public ProductShape Add(ProductShape pt) { _unitOfWork.Repository <ProductShape>().Insert(pt); return(pt); }
public void Update(ProductShape pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <ProductShape>().Update(pt); }
public void Delete(ProductShape pt) { _unitOfWork.Repository <ProductShape>().Delete(pt); }
public ProductShape Create(ProductShape pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <ProductShape>().Insert(pt); return(pt); }