Пример #1
0
        public Database.Schema.Entity.TuitionType AddTuitionType(TuitionTypeManagement tuitionTypeManagement)
        {
            var tuitionType = context.TuitionTypes.Add(new Database.Schema.Entity.TuitionType
            {
                Money       = tuitionTypeManagement.Money,
                Name        = tuitionTypeManagement.Name,
                Description = tuitionTypeManagement.Description
            });

            context.SaveChanges();
            return(tuitionType);
        }
Пример #2
0
 public TuitionTypes EditTuitionType(TuitionTypeManagement tuitionTypeManagement, int id)
 {
     context.TuitionTypes.Where(x => x.Id == id && !x.DelFlag).Update(x => new Database.Schema.Entity.TuitionType
     {
         Money       = tuitionTypeManagement.Money,
         Name        = tuitionTypeManagement.Name,
         Description = tuitionTypeManagement.Description
     });
     context.SaveChanges();
     return(new TuitionTypes {
         Id = id,
         Money = tuitionTypeManagement.Money,
         Name = tuitionTypeManagement.Name,
         Description = tuitionTypeManagement.Description
     });
 }
        public IHttpActionResult EditTuitionType([FromBody] TuitionTypeManagement tuitionType, int id)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                return(Ok(_tuitionManagementService.EditTuitionType(tuitionType, id)));
            }
            catch (System.Exception e)
            {
                return(InternalServerError(e));
            }
        }