コード例 #1
0
ファイル: AdminController.cs プロジェクト: jasmeet321/GSS
        public virtual ActionResult AddHukamnama(HukamnamaModel model)
        {
            string filename = string.Empty;

            #region Check File Upload
            var httpPostedFileBase = Request.Files[0];
            if (httpPostedFileBase != null && (Request.Files.Count > 0 && httpPostedFileBase.FileName != string.Empty))
            {
                if (Request.Files[0].FileName != string.Empty)
                {
                    model.HukamnamImage = null;
                    filename            = UploadDocument();
                    if (filename == string.Empty)
                    {
                        return(View());
                    }
                }

                else
                {
                    ViewBag.message = "Please upload the Image";
                    return(View());
                }
            }

            #endregion

            if (ModelState.IsValid)
            {
                _objuser         = new UserPresenter();
                model.CratedDate = DateTime.Now;
                model.IsActive   = true;
                if (model.HukamnamImage != null)
                {
                    filename            = model.HukamnamImage;
                    model.HukamnamImage = filename;
                }
                else
                {
                    model.HukamnamImage = filename == string.Empty ? string.Empty : "HukamnamaImages/" + filename;
                }
                if (filename != string.Empty)
                {
                    SaveHukamnama(filename);
                }
                var ioutput = _objuser.AddHukamnama(model);
                return(RedirectToAction(MVC.Admin.GetHukamnamasResult()));
            }
            else
            {
                string message = "Inavlid data";
                ModelState.AddModelError("", message);
            }
            return(View());
        }
コード例 #2
0
ファイル: AdminController.cs プロジェクト: jasmeet321/GSS
        // Hukamnama Section

        #region Hukamnama

        public virtual ActionResult AddHukamnama(string id)
        {
            HukamnamaModel model = null;

            _objuser = new UserPresenter();
            if (!string.IsNullOrEmpty(id))
            {
                model = _objuser.GetHukamnama(int.Parse(id));
            }
            return(View(model));
        }
コード例 #3
0
        public bool UpdateHukamnama(HukamnamaModel model)
        {
            var objhukamnama = new Hukamnama
            {
                Tittle        = model.Tittle,
                HukamnamImage = model.HukamnamImage,
                CratedDate    = DateTime.Now,
                ModifiedDate  = DateTime.Now,
                IsActive      = true
            };

            return(_objRepository.UpdateHukamnama(objhukamnama));
        }