Exemple #1
0
 public bool SaveChanges()
 {
     try
     {
         _ctx.SetMetadata();
         return(_ctx.SaveChanges() > 0);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemple #2
0
        public ServiceCallResult <bool> AddRequestNote([FromBody] RequestNoteViewModel requestNote)
        {
            try
            {
                _wtContext.SetCurrentUser(Auth.GetCurrentUser(User.Identity.Name).fullName);

                RequestNote newRequestNote = new RequestNote();
                newRequestNote.RequestId = requestNote.RequestId;
                newRequestNote.Note      = requestNote.Note;

                _wtContext.RequestNotes.Add(newRequestNote);
                _wtContext.SaveChanges();

                return(ServiceCallResult <bool> .CreateSuccessResult(String.Format(UserMessageResource.FieldAddedSuccessfully, FieldNamesResource.RequestNote), true));
            }
            catch (Exception ex)
            {
                return(ServiceCallResult <bool> .CreateErrorResult(String.Format(UserMessageResource.ErrorAddingField, FieldNamesResource.RequestNote) + ex.Message, false));
            }
        }