//Update public string update(ProductFashtionDto tProductFashtionDto) { try { ProductFashtion tProductFashtionUpdate = _context.ProductFashtion.Find(tProductFashtionDto.Id); if (tProductFashtionUpdate == null) { return("1"); } tProductFashtionUpdate.Id = tProductFashtionDto.Id; tProductFashtionUpdate.Name = tProductFashtionDto.Name; tProductFashtionUpdate.RetailPrice = tProductFashtionDto.RetailPrice; tProductFashtionUpdate.WholesalePrice = tProductFashtionDto.WholesalePrice; tProductFashtionUpdate.Description = tProductFashtionDto.Description; tProductFashtionUpdate.Status = tProductFashtionDto.Status; tProductFashtionUpdate.CreateDate = tProductFashtionDto.CreateDate; tProductFashtionUpdate.CreateUser = tProductFashtionDto.CreateUser; _context.ProductFashtion.Update(tProductFashtionUpdate); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }
public ProductFashtionDto get(string id) { try { ProductFashtion bb = _context.ProductFashtion.Find(id); // _context.Entry(bb).Reference(b => b.Bank).Load(); // _context.Entry(bb).Reference(b => b.Province).Load(); return(mapper.Map <ProductFashtion, ProductFashtionDto>(bb)); } catch (Exception) { return(null); } }
public string create(ProductFashtionDto tProductFashtionDto) { try { ProductFashtion tProductFashtionNew = mapper.Map <ProductFashtionDto, ProductFashtion>(tProductFashtionDto); tProductFashtionNew.Id = Guid.NewGuid().ToString(); tProductFashtionNew.CreateDate = DateTime.Now; _context.ProductFashtion.Add(tProductFashtionNew); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }
public string delete(string id) { try { ProductFashtion tProductFashtionRemove = _context.ProductFashtion.Find(id); if (tProductFashtionRemove == null) { return("1"); } _context.ProductFashtion.Remove(tProductFashtionRemove); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }
public string lockItem(string id) { try { ProductFashtion tProductFashtionBlock = _context.ProductFashtion.Find(id); if (tProductFashtionBlock == null) { return("1"); } tProductFashtionBlock.Status = false; _context.ProductFashtion.Update(tProductFashtionBlock); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }