public ActionResult GetPartyProjectById(Domain.DTO.PartyProject project)
        {
            try
            {
                var all = PartyProjectService.GetKey(project.Id);
                var dto = ObjectMapper.BaseConverter
                          .ConvertSourceToDest <PartyProject, Domain.DTO.PartyProject>(all);
                dto.FromDateJalali = all.FromDate.ConvertMiladiToJalali();
                dto.ToDateJalali   = all.Todate.ConvertMiladiToJalali();//.ConvertMiladiToJalali();

                SuccessApiResponse.Result = dto;
                return(Json(SuccessApiResponse, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(ErrorApiResponse, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult SavePartyProject(Domain.DTO.PartyProject partyProject)
        {
            try
            {
                var current = PartyProjectService
                              .Get(x => x.PartyId == partyProject.PartyId && x.Id == partyProject.Id).FirstOrDefault();


                //partyUniversity.UniversityFromDate = partyUniversity.UniversityFromDate != null &&
                //                                     partyUniversity.UniversityFromDate.PersianNumberToLatin()
                //                                         .IsValidPersianDate()
                //    ? partyUniversity.UniversityFromDate.PersianNumberToLatin().ConvertJalaliToMiladi()
                //        .ToString()
                //    : null;

                //partyUniversity.UniversityToDate = partyUniversity.UniversityToDate != null &&
                //                                   partyUniversity.UniversityToDate.PersianNumberToLatin()
                //                                       .IsValidPersianDate()
                //    ? partyUniversity.UniversityToDate.PersianNumberToLatin().ConvertJalaliToMiladi()
                //        .ToString()
                //    : null;

                var entity = new PartyProject
                {
                    PartyId            = partyProject.PartyId,
                    Created            = DateTime.Now,
                    CreatedBy          = partyProject.UserName,
                    FromDate           = partyProject.FromDateJalali.ConvertJalaliToMiladi(),
                    Todate             = partyProject.ToDateJalali.ConvertJalaliToMiladi(),
                    Modified           = DateTime.Now,
                    ModifiedBy         = partyProject.UserName,
                    ProjectDescription = partyProject.ProjectDescription,
                    ProjectTitle       = partyProject.ProjectTitle
                };

                //if (experience.FromDate.IsValidPersianDate())
                //{
                //    entity.FromDate = experience.FromDate.ConvertJalaliToMiladi();

                //}

                //if (experience.ToDate.IsValidPersianDate())
                //{
                //    entity.ToDate = experience.ToDate.ConvertJalaliToMiladi();
                //}

                if (current != null)
                {
                    entity.Id = current.Id;
                }

                entity.Modified   = DateTime.Now;
                entity.Created    = current?.Created ?? DateTime.Now;
                entity.CreatedBy  = current?.CreatedBy ?? partyProject.UserName;
                entity.ModifiedBy = partyProject.UserName;


                using (var db = new IranMarketerContext())
                {
                    if (current == null)
                    {
                        db.PartyProjects.Add(entity);
                    }
                    else
                    {
                        db.Entry(entity).State = EntityState.Modified;
                    }
                    db.SaveChanges();
                }
                return(this.Json(this.SuccessApiResponse, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(ErrorApiResponse, JsonRequestBehavior.AllowGet));
            }
        }