예제 #1
0
        public IHttpActionResult SaveBrandingSettings(SaveBrandingRequest request)
        {
            if (request.Id <= 0)
            {
                return(ResponseMessage(CreateCustomResponseMessage(HttpStatusCode.BadRequest)));
            }
            var result = _userService.SaveBrandingSettings(request);

            return(ResponseMessage(CreateCustomResponseMessage(result)));
        }
예제 #2
0
 public ServiceResponse SaveBrandingSettings(SaveBrandingRequest request)
 {
     using (DiaryContext db = new DiaryContext())
     {
         var userDetails = db.UserDetails.FirstOrDefault(x => x.Id == request.Id);
         if (userDetails == null)
         {
             return(new ServiceResponse(HttpStatusCode.BadRequest, "There is no existing user details with given id!"));
         }
         userDetails.BrandingSettings = request.BrandingSettings;
         db.SaveChanges();
     }
     return(new ServiceResponse(HttpStatusCode.OK, "Branding saved!"));
 }