//Update ImageKind public IHttpActionResult Update(ImageKindViewModel imageKindViewModel) { var ImageKind = _ImageKindService.GetImageKind(imageKindViewModel.Id); ImageKind.Description = imageKindViewModel.Description; ImageKind.Kind = imageKindViewModel.Kind; _ImageKindService.EditImageKind(ImageKind); return(Ok()); }
public IHttpActionResult Create(ImageKindViewModel imageKind) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ImageKind ik = new ImageKind(); ik.Description = imageKind.Description; ik.Kind = imageKind.Kind; _ImageKindService.CreateImageKind(ik); return(Ok()); }
//Get all ImageKind public IHttpActionResult Get() { var ImageKinds = _ImageKindService.GetImageKinds(); List <ImageKindViewModel> ikvms = new List <ImageKindViewModel>(); foreach (var ImageKind in ImageKinds) { ImageKindViewModel ikvm = new ImageKindViewModel(); ikvm.Id = ImageKind.Id; ikvm.Kind = ImageKind.Kind; ikvm.Description = ImageKind.Description; ikvm.DateCreate = ImageKind.DateCreate; ikvms.Add(ikvm); } return(Ok(ikvms)); }
//Destroy ImageKind by ViewModel public IHttpActionResult Destroy(ImageKindViewModel imageKindViewModel) { _ImageKindService.RemoveImageKind(imageKindViewModel.Id); return(Ok()); }