public ColorViewModel Add(ColorViewModel brandVm) { var brand = Mapper.Map <ColorViewModel, Color>(brandVm); _brandRepository.Add(brand); return(brandVm); }
public bool SaveEntity(ColorModel colorModel) { try { if (colorModel.Id > 0) { var color = GetColorById(colorModel.Id).ToColor(); color.Id = colorModel.Id; color.Name = colorModel.Name; color.Code = colorModel.Code; color.UpdatedDate = DateTime.Now; _colorRepository.Update(color); return(true); } else { var color = new Color(); color.Id = colorModel.Id; color.Name = colorModel.Name; color.Code = colorModel.Code; color.CreatedDate = DateTime.Now; _colorRepository.Add(color); return(true); } } catch (Exception ex) { return(false); } }
public Color Add(Color color) { if (_colorRepository.CheckContains(x => x.Name == color.Name)) { throw new NameDuplicatedException("Tên không được trùng"); } return(_colorRepository.Add(color)); }
public ColorMutation(IColorRepository colorRepository, ITranslationRepository translationRepository) { Name = "Mutation"; Field <ColorType>( "create", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <ColorType> > { Name = "color" } ), resolve: context => { var color = context.GetArgument <Color>("color"); return(colorRepository.Add(color)); }); }
public ActionResult Add(ColorDTO entity) { try { Color color = new Color() { ColorName = entity.ColorName }; colorRepository.Add(color); colorRepository.Save(); return(Json(entity, JsonRequestBehavior.DenyGet)); } catch (Exception e) { return(Json(false, JsonRequestBehavior.DenyGet)); } }
public Response AddColor(Color color) { Response response = new Response(); if (colorRepository.GetAll().Any(t => t.ColorName == color.ColorName)) { response.Success = false; response.Message = "ERROR: Color name already exists"; } else { colorRepository.Add(color); response.Success = true; response.Message = "Color added"; } return(response); }
public async Task Add(Color brand) { await _brandRepository.Add(brand); }
public void AddColor(Color color) { _colorRepository.Add(color); }
public void Add(Color Color) { _colorRepository.Add(Color); }
public IActionResult Add([FromBody]Color color, [FromRoute] int page = 1, [FromRoute]int pagesize = 10) { _colorRepo.Add(color); _colorRepo.Save(); return ColorsList(page, pagesize); }
public Color Add(Color color) { return(_colorRepository.Add(color)); }
public void Create(ColorViewModel colorVm) { var color = _mapper.Map <ColorViewModel, Color>(colorVm); _colorRepository.Add(color); }
public void Add(Color color) { colorRepository.Add(color); Save(); }
public async Task Add(ColorViewModel pageVm) { var page = new ColorViewModel().Map(pageVm); await _colorRepository.Add(page); }