示例#1
0
        //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());
        }
示例#2
0
        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());
        }
示例#3
0
        //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));
        }
示例#4
0
 //Destroy ImageKind by ViewModel
 public IHttpActionResult Destroy(ImageKindViewModel imageKindViewModel)
 {
     _ImageKindService.RemoveImageKind(imageKindViewModel.Id);
     return(Ok());
 }