Example #1
0
        /// <summary>
        /// Save Change Calling From Api
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public object SaveChenage(UserVM user, bool isUpdateData, bool isUpdateCountry = false)
        {
            //PagesAllow PageAllow = PageService.GetPageAllow(PageEnumVM.Users);


            try
            {
                var ObjectReturn = CreateS.User(user);

                if (ObjectReturn != null)
                {
                    return(ObjectReturn);
                }

                db.SaveChanges();

                return(new ResponseVM {
                    RequestType = RequestTypeEnumVM.Success, Message = isUpdateData || isUpdateData ? Token.Updated : Token.Created
                });
            }
            catch (Exception ex)
            {
                return(new ResponseVM {
                    RequestType = RequestTypeEnumVM.Error, Message = Token.NotSaveChange, DevMessage = ex.Message
                });
            }
        }
Example #2
0
        //Save Chenage
        public object SaveChenage(Address address, User user, UserRole[] userRoles, HttpPostedFileBase image, bool isUpdate)
        {
            try
            {
                var ObjectReturn = new object();
                if (isUpdate)
                {
                    ObjectReturn = UpdateS.User(address, user, image);
                }
                else
                {
                    ObjectReturn = CreateS.User(address, user, userRoles, image);
                }

                if (ObjectReturn != null)
                {
                    return(ObjectReturn);
                }

                db.SaveChanges();

                this.RemoveFiles();
                if (isUpdate)
                {
                    return new { RequestType = RequestTypeEnumVM.Success, Message = Token.Saved, User = GetUserDataForUpdate(user.Id) }
                }
                ;
                else
                {
                    return new { RequestType = RequestTypeEnumVM.Success, Message = Token.Saved, User = GetUserDataForUpdate(user.Id) }
                };
            }
            catch (Exception ex)
            {
                return(new { RequestType = RequestTypeEnumVM.Error, Message = Token.NotSaveChange });
            }
        }