public string UpdateStudentPromotion(UpdateStudentPromotion obj)
        {
            string returnResult = (dynamic)null;

            try
            {
                if (obj != null)
                {
                    var ClassYear = DateTime.ParseExact(obj.StudentPromotions.Year, "yyyy", null);
                    if (obj.StudentPromotions != null)
                    {
                        var currentItem = _StudentPromotionsRepo.Get(obj.StudentPromotions.Id);
                        currentItem.Id           = obj.StudentPromotions.Id;
                        currentItem.StudentId    = obj.StudentPromotions.StudentId;
                        currentItem.ClassId      = obj.StudentPromotions.ClassId;
                        currentItem.RollNo       = obj.StudentPromotions.RollNo;
                        currentItem.ClassYear    = ClassYear;
                        currentItem.IsActive     = obj.StudentPromotions.IsActive;
                        currentItem.AddedBy      = 0;
                        currentItem.AddedDate    = DateTime.Now;
                        currentItem.ModifiedBy   = 0;
                        currentItem.ModifiedDate = DateTime.Now;
                        currentItem.DataType     = null;

                        _StudentPromotionsRepo.Update(currentItem);
                        returnResult = "Saved";
                    }
                }
            }
            catch (Exception ex)
            {
                returnResult = "ERROR102:FeeTypesServ/UpdateFeeTypes - " + ex.Message;
            }

            return(returnResult);
        }
        public string UpdateStudent(UpdateStudent obj)
        {
            string returnResult = (dynamic)null;

            try
            {
                if (obj != null)
                {
                    var AdmittedYear = DateTime.ParseExact(obj.Students.Year, "yyyy", null);
                    if (obj.Students != null)
                    {
                        var currentItem = _studentsRepo.Get(obj.Students.Id);
                        currentItem.ClassId          = obj.Students.ClassId;
                        currentItem.GenderId         = obj.Students.GenderId;
                        currentItem.RegistrationNo   = obj.Students.RegistrationNo;
                        currentItem.FirstName        = obj.Students.FirstName;
                        currentItem.LastName         = obj.Students.LastName;
                        currentItem.AdmittedYear     = AdmittedYear;
                        currentItem.PresentAddress   = obj.Students.PresentAddress;
                        currentItem.PermanentAddress = obj.Students.PermanentAddress;
                        currentItem.DOB          = obj.Students.DOB;
                        currentItem.IsActive     = obj.Students.IsActive;
                        currentItem.ModifiedBy   = 0;
                        currentItem.ModifiedDate = DateTime.Now;
                        currentItem.FatherName   = obj.Students.FatherName;
                        currentItem.MotherName   = obj.Students.MotherName;
                        if (obj.Students.fleImage == null)
                        {
                            if (obj.Students.IP300X200 != null)
                            {
                                currentItem.IP300X200 = obj.Students.IP300X200;
                            }
                            else
                            {
                                //[NOTE: delete image from 'ClientDictionary']
                                string targetImageLocation = Path.Combine(obj.WebRootPath, currentItem.IP300X200);
                                _commonServ.DelFileFromLocation(targetImageLocation);
                            }
                        }
                        else
                        {
                            //[NOTE: delete image from 'ClientDictionary-if extensions are different']
                            if (currentItem.IP300X200 != null)
                            {
                                string targetImageLocation = Path.Combine(obj.WebRootPath, currentItem.IP300X200);
                                _commonServ.DelFileFromLocation(targetImageLocation);
                            }

                            //[NOTE: Upddate image]
                            string imagePathIP300X200 = "ClientDictionary/Students/IP300X200/";
                            string extension          = Path.GetExtension(obj.Students.fleImage.FileName);
                            if (_commonServ.CommImage_ImageFormat(obj.Students.Id.ToString(), obj.Students.fleImage, obj.WebRootPath, imagePathIP300X200, 200, 300, extension).Equals(true))
                            {
                                currentItem.IP300X200 = imagePathIP300X200 + obj.Students.Id + extension;
                            }
                        }
                        _studentsRepo.Update(currentItem);
                        returnResult = "Saved";
                    }
                    //[NOTE: Student promotion table table]

                    if (obj.StudentPromotions != null)
                    {
                        var promotion       = _StudentPromotionsRepo.GetAll().ToList();
                        var getStuPromotion = (from sp in promotion
                                               where sp.StudentId == obj.Students.Id
                                               select sp).FirstOrDefault();
                        getStuPromotion.ClassId      = obj.Students.ClassId;
                        getStuPromotion.RollNo       = obj.StudentPromotions.RollNo;
                        getStuPromotion.ClassYear    = AdmittedYear;
                        getStuPromotion.IsActive     = obj.Students.IsActive;
                        getStuPromotion.ModifiedBy   = 0;
                        getStuPromotion.ModifiedDate = DateTime.Now;
                        _StudentPromotionsRepo.Update(getStuPromotion);
                        returnResult = "Saved";
                    }
                }
            }
            catch (Exception ex)
            {
                returnResult = "ERROR102:AddressesServ/UpdateAddress - " + ex.Message;
            }
            return(returnResult);
        }