public ActionResult _Create(int Id) //Id ==>Sale Order Header Id
        {
            PersonBankAccount s = new PersonBankAccount();

            s.PersonId = Id;
            PrepareViewBag(null);
            return(PartialView("_Create", s));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            PersonBankAccount PersonBankAccount = _PersonBankAccountService.Find(id);

            _PersonBankAccountService.Delete(id);


            _unitOfWork.Save();

            return(RedirectToAction("Index", new { Id = PersonBankAccount.PersonId }).Success("Data deleted successfully"));
        }
        public ActionResult _Edit(int id)
        {
            PersonBankAccount temp = _PersonBankAccountService.GetPersonBankAccount(id);

            PrepareViewBag(temp);

            if (temp == null)
            {
                return(HttpNotFound());
            }
            return(PartialView("_Create", temp));
        }
        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PersonBankAccount PersonBankAccount = _PersonBankAccountService.Find(id);

            if (PersonBankAccount == null)
            {
                return(HttpNotFound());
            }
            return(View(PersonBankAccount));
        }
        public ActionResult DeletePost(PersonBankAccount vm)
        {
            _PersonBankAccountService.Delete(vm.PersonBankAccountID);

            try
            {
                _unitOfWork.Save();
            }

            catch (Exception ex)
            {
                string message = _exception.HandleException(ex);
                ModelState.AddModelError("", message);
                return(PartialView("EditSize", vm));
            }
            return(Json(new { success = true }));
        }
        public ActionResult _CreatePost(PersonBankAccount svm)
        {
            if (ModelState.IsValid)
            {
                if (svm.PersonBankAccountID == 0)
                {
                    svm.CreatedDate  = DateTime.Now;
                    svm.ModifiedDate = DateTime.Now;
                    svm.CreatedBy    = User.Identity.Name;
                    svm.ModifiedBy   = User.Identity.Name;
                    svm.ObjectState  = Model.ObjectState.Added;
                    _PersonBankAccountService.Create(svm);


                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(PartialView("_Create", svm));
                    }
                    return(RedirectToAction("_Create", new { id = svm.PersonId }));
                }
                else
                {
                    svm.ModifiedBy   = User.Identity.Name;
                    svm.ModifiedDate = DateTime.Now;
                    _PersonBankAccountService.Update(svm);


                    //Saving the Activity Log
                    ActivityLog al = new ActivityLog()
                    {
                        ActivityType = (int)ActivityTypeContants.Modified,
                        DocId        = svm.PersonBankAccountID,
                        CreatedDate  = DateTime.Now,
                        //Narration = logstring.ToString(),
                        CreatedBy = User.Identity.Name,
                        //DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(TransactionDocCategoryConstants.PersonBankAccount).DocumentTypeId,
                    };
                    new ActivityLogService(_unitOfWork).Create(al);
                    //End of Saving the Activity Log


                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(PartialView("_Create", svm));
                    }


                    return(Json(new { success = true }));
                }
            }

            PrepareViewBag(svm);
            return(PartialView("_Create", svm));
        }
 private void PrepareViewBag(PersonBankAccount s)
 {
 }
 public PersonBankAccount Add(PersonBankAccount pt)
 {
     _unitOfWork.Repository <PersonBankAccount>().Insert(pt);
     return(pt);
 }
 public void Update(PersonBankAccount pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <PersonBankAccount>().Update(pt);
 }
 public void Delete(PersonBankAccount pt)
 {
     _unitOfWork.Repository <PersonBankAccount>().Delete(pt);
 }
 public PersonBankAccount Create(PersonBankAccount pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <PersonBankAccount>().Insert(pt);
     return(pt);
 }