public IResult Delete(int departmentId)
        {
            var department = GetById(departmentId).Data;

            department.IsEnable  = false;
            department.UpdatedAt = DateTime.Now;

            departmentDal.Update(department);
            return(new SuccessResult(Messages.DepartmentDeleted));
        }
Exemplo n.º 2
0
        public void PromoteManager(int departmentId, int personalId)
        {
            Department department = departmentDal.Get(x => x.Id == departmentId);

            department.ManagerId = personalId;

            departmentDal.Update(department);
        }
Exemplo n.º 3
0
        public void Update(Department department)
        {
            if (department == null)
            {
                throw new System.NotImplementedException();
            }

            _departmentDal.Update(department);
        }
Exemplo n.º 4
0
        public IResult Update(Department department)
        {
            var result = _departmentDal.Any(d => d.Name == department.Name);

            if (result)
            {
                _departmentDal.Update(department);
                return(new SuccessResult(Messages.Department.Update(department.Name)));
            }
            return(new ErrorResult(Messages.NotFound()));
        }
Exemplo n.º 5
0
        public async Task <DepartmentForReturnDto> Update(DepartmentForCreationDto updateDto)
        {
            var checkById = await departmentDal.GetAsync(x => x.Id == updateDto.Id);

            if (checkById == null)
            {
                throw new RestException(HttpStatusCode.BadRequest, new { NotFound = Messages.NotFound });
            }

            var mapForUpdate = mapper.Map(updateDto, checkById);
            await departmentDal.Update(mapForUpdate);

            return(mapper.Map <Department, DepartmentForReturnDto>(mapForUpdate));
        }
 public void Update(Department entity)
 {
     if (Validation(entity))
     {
         return;
     }
     try
     {
         _departmentDal.Update(entity);
         Message.Info("Bölüm Güncellendi");
     }
     catch
     {
         Message.Error("Bölüm Güncellenemedi!");
     }
 }
        protected void DeptGrid_OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridError.Text = string.Empty;

            var id = DeptGrid?.DataKeys[e.RowIndex]?.Value;

            if (id == null)
            {
                return;
            }

            var newName = e.NewValues["DepartmentName"].ToString();

            var dept = _departmentDal.Get((int)id);

            if (dept.DepartmentName == newName)
            {
                DeptGrid.EditIndex = -1;
                return;
            }

            dept.DepartmentName = newName;

            try
            {
                _departmentDal.Update(dept);
            }
            catch (ValidationException ex)
            {
                GridError.Text = ex.Message;
            }
            catch (NotFoundException ex)
            {
                GridError.Text = ex.Message;
            }
            catch (Exception)
            {
                GridError.Text = "An error occured while updating the department.";
            }
            finally
            {
                DeptGrid.EditIndex = -1;
                RefreshGrid();
            }
        }
Exemplo n.º 8
0
 public void Update(Department entity)
 {
     _departmentDal.Update(entity);
 }
Exemplo n.º 9
0
 public Department Update(Department department)
 {
     return(_departmentDal.Update(department));
 }
Exemplo n.º 10
0
 public void Update(Department department)
 {
     _departmentDal.Update(department);
 }
Exemplo n.º 11
0
 public IResult Update(Department department)
 {
     _departmentDal.Update(department);
     return(new SuccessResult(Messages.DepartmentSuccessfullyUpdated));
 }
Exemplo n.º 12
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(thesis.model.Department model)
 {
     dal.Update(model);
 }
 public Department Update(Department department)
 {
     return(AutoMapperHelper.MapToSameType(_departmentDal.Update(department)));
 }
Exemplo n.º 14
0
 public Department Update(Department entity)
 {
     return(_departmentDal.Update(entity));
 }
Exemplo n.º 15
0
 public IResult Update(Department entity)
 {
     _departmentDal.Update(entity);
     return(new SuccessResult(Messages.DepartmentUpdated));
 }