Ejemplo n.º 1
0
        /// <summary>
        /// Добавление нового отделения.
        /// </summary>
        /// <param name="department">Отделение, которое следует добавить.</param>
        public async void Insert(IEntity department)
        {
            ID       = department.ID;
            DeptName = (department as Department).DeptName;
            DeptInfo = (department as Department).DeptInfo;

            DataServiceStub ds = new DataServiceStub();
            await ds.InsertDepartment(this);
        }
 /// <summary>
 /// Добавление нового отделения в БД.
 /// </summary>
 /// <param name="department">Отделение, которое следует добавить в БД.</param>
 /// <returns>Статус выполнения запроса</returns>
 public HttpResponseMessage Post([FromBody] Department department)
 {
     try
     {
         DataServiceStub ds = new DataServiceStub();
         ds.InsertDepartment(department);
         return(Request.CreateResponse(HttpStatusCode.Created));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest, ex));
     }
 }