Пример #1
0
        public async Task <FeatureGroupViewModel> Get(Guid index)
        {
            var c = await this._unitOfWork.FeatureGroups.GetItem(index);

            var grp = new FeatureGroupViewModel
            {
                ID          = c.ID,
                Name        = c.Name,
                Description = c.Description
            };

            return(grp);
        }
Пример #2
0
        public async Task <IActionResult> Update([FromBody] FeatureGroupViewModel value, Guid?index)
        {
            if (ModelState.IsValid)
            {
                var grp = new FeatureGroup
                {
                    ID          = Guid.NewGuid(),
                    Name        = value.Name,
                    Description = value.Description,
                    CreatedBy   = userId,
                    UpdatedBy   = userId,
                    CreatedDate = DateTime.Now,
                    UpdatedDate = DateTime.Now,
                };

                //commit
                var ret = await this._unitOfWork.FeatureGroups.Update(grp, value.ID);

                //return client side
                return(Ok(ret));
            }

            return(BadRequest(ModelState));
        }