public string create(ProductFashtionImagesDto tProductFashtionImagesDto) { try { ProductFashtionImages tProductFashtionImagesNew = mapper.Map <ProductFashtionImagesDto, ProductFashtionImages>(tProductFashtionImagesDto); tProductFashtionImagesNew.Id = Guid.NewGuid().ToString(); // tProductFashtionImagesNew.CreateDate = DateTime.Now; _context.ProductFashtionImages.Add(tProductFashtionImagesNew); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }
//Update public string update(ProductFashtionImagesDto tProductFashtionImagesDto) { try { ProductFashtionImages tProductFashtionImagesUpdate = _context.ProductFashtionImages.Find(tProductFashtionImagesDto.Id); if (tProductFashtionImagesUpdate == null) { return("1"); } tProductFashtionImagesUpdate.Id = tProductFashtionImagesDto.Id; tProductFashtionImagesUpdate.ImagesFashtionId = tProductFashtionImagesDto.ImagesFashtionId; tProductFashtionImagesUpdate.ProductFashtionId = tProductFashtionImagesDto.ProductFashtionId; tProductFashtionImagesUpdate.Status = tProductFashtionImagesDto.Status; _context.ProductFashtionImages.Update(tProductFashtionImagesUpdate); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }
public IActionResult Update([FromBody] ProductFashtionImagesDto value) { string result = _tprdFIages.update(value); return(new ObjectResult(result)); }