public TextFlashCardModel GetTextFlashCardById(int id)
        {
            TextFlashCardModel model = null;
            var entity = _uow.TextFlashCards.GetById(id);

            if (entity != null)
            {
                model = MappingUtil.Map <TextFlashCard, TextFlashCardModel>(entity);
            }
            return(model);
        }
Beispiel #2
0
        public HttpResponseMessage Patch([FromBody] TextFlashCardModel model)
        {
            try
            {
                if (ModelState.IsValid == false || _textFlashCardSvc.UpdateTextFlashCard(model) == false)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
                }

                return(Request.CreateResponse(HttpStatusCode.OK, model));
            }
            catch (ServiceException ex)
            {
                return(Request.CreateResponse(ex.HttpStatusCode, ex.Message));
            }
        }
        public bool UpdateTextFlashCard(TextFlashCardModel model)
        {
            try
            {
                var entity = MappingUtil.Map <TextFlashCardModel, TextFlashCard>(model);
                _uow.TextFlashCards.Update(entity);
                _uow.SaveChanges();
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(false);
            }

            return(true);
        }
 public void UpdateModel(TextFlashCardModel model)
 {
 }