示例#1
0
        public Message AddOrEdit(SocialAccountType socialAccountType)
        {
            var message = new Message();
            var ID      = socialAccountType.SocialAccountTypeId;
            int result  = _iSocialAccountTypeRepository.AddOrEdit(socialAccountType);

            try
            {
                if (result > 0)
                {
                    if (Convert.ToInt32(ID) > 0)
                    {
                        message = Message.SetMessages.SetSuccessMessage("Submission Updated Successfully!");
                    }
                    else
                    {
                        message = Message.SetMessages.SetSuccessMessage("Submission Successful!");
                    }
                }
                else
                {
                    message = Message.SetMessages.SetErrorMessage("Could not be submitted!");
                }
            }
            catch (Exception e)
            {
                message = Message.SetMessages.SetWarningMessage(e.Message.ToString());
            }

            return(message);
        }
示例#2
0
        public ActionResult AddOrEdit(int id = 0)
        {
            SocialAccountType socialAccountType = new SocialAccountType();

            if (id != 0)
            {
                socialAccountType = _iSocialAccountTypeManager.GetASocialAccountType(id);
            }
            return(View(socialAccountType));
        }
示例#3
0
        public ActionResult AddOrEdit(SocialAccountType socialAccountType)
        {
            //if (uploadedFile != null)
            //{
            //    string fileName = Path.GetFileNameWithoutExtension(uploadedFile.FileName);
            //    string extension = Path.GetExtension(uploadedFile.FileName);
            //    fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension;
            //    socialAccountType.SocialAccountTypeImage = "~/Image/SocialAccountType/" + fileName;
            //    uploadedFile.SaveAs(Path.Combine(Server.MapPath("~/Image/SocialAccountType/"), fileName));

            //}
            var data = _iSocialAccountTypeManager.AddOrEdit(socialAccountType);

            return(Json(new { messageType = data.MessageType, message = data.ReturnMessage, html = GlobalClass.RenderRazorViewToString(this, "ViewAll", _iSocialAccountTypeManager.GetAllSocialAccountType()) }, JsonRequestBehavior.AllowGet));
        }
        public int AddOrEdit(SocialAccountType socialAccountType)
        {
            if (socialAccountType.SocialAccountTypeId == 0)
            {
                socialAccountType.CreatedDate = DateTime.Now;
                socialAccountType.UpdatedDate = DateTime.Now;
                socialAccountType.CreatedBy   = 1;
                socialAccountType.UpdatedBy   = 1;
                _dbContext.SocialAccountTypes.Add(socialAccountType);
            }
            else
            {
                socialAccountType.UpdatedBy               = 1;
                socialAccountType.UpdatedDate             = DateTime.Now;
                _dbContext.Entry(socialAccountType).State = EntityState.Modified;
            }

            return(_dbContext.SaveChanges());
        }