示例#1
0
        public object DeleteAcademic(UpdateAcademicYear PM)
        {
            try
            {
                Tbl_AcademicYear_Master obj = db.Tbl_AcademicYear_Master.Where(r => r.AcademicID == PM.AcademicID).FirstOrDefault();


                if (obj.Status == 1)
                {
                    obj.Status = 0;
                }
                else
                {
                    obj.Status = 1;
                }

                db.SaveChanges();

                return(new Result()
                {
                    IsSucess = true, ResultData = "State Deactivated Successfully."
                });
            }
            catch (Exception e)
            {
                return(new Error()
                {
                    IsError = true, Message = e.Message
                });
            }
        }
        public object AcademicUpdate(UpdateAcademicYear b)
        {
            if (b.Type == null)
            {
                return(new Error()
                {
                    IsError = true, Message = "Required State"
                });
            }
            var data = db.Tbl_AcademicYear_Master.Where(r => r.AcademicID == b.AcademicID).FirstOrDefault();

            try
            {
                Tbl_AcademicYear_Master obj = new Tbl_AcademicYear_Master();
                data.Type         = b.Type;
                data.StartDate    = Convert.ToDateTime(b.StartDate.ToShortDateString());
                data.EndDate      = Convert.ToDateTime(b.EndDate.ToShortDateString());
                data.ModifiedBy   = null;
                data.ModifiedDate = System.DateTime.Today.Date;
                db.SaveChanges();
                return(new Result()
                {
                    IsSucess = true, ResultData = "Update Academic"
                });
            }
            catch (Exception e)
            {
                return(new Error()
                {
                    IsError = true, Message = e.Message
                });
            }
        }
 public object DeleteAcademic([FromBody] UpdateAcademicYear PM)
 {
     try
     {
         AcademicYearBussiness b = new AcademicYearBussiness();
         var Result = b.DeleteAcademic(PM);
         return(Result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
        public object UpdateAcademic(UpdateAcademicYear b)
        {
            try
            {
                AcademicYearBussiness data = new AcademicYearBussiness();
                var Result = data.AcademicUpdate(b);

                return(Result);
            }
            catch (Exception e)
            {
                return(new Error()
                {
                    IsError = true, Message = e.Message
                });
            }
        }
示例#5
0
 public object GetSingleYear(UpdateAcademicYear b)
 {
     try
     {
         var data = db.ViewAcademicYearLists.Where(r => r.AcademicID == b.AcademicID).FirstOrDefault();
         return(new Result()
         {
             IsSucess = true, ResultData = data
         });
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }