Exemplo n.º 1
0
        public async Task <ActionResultReponese <string> > InsertAsync(string IdFaculty, DepartmentMeta bomonMeta)
        {
            var isFaculty = await _facultyRepository.CheckExitsFacult(IdFaculty);

            if (!isFaculty)
            {
                return(new ActionResultReponese <string>(-21, "IdFaculty not found", "Faculty", null));
            }
            var _bomon = new Department
            {
                //  id = Guid.NewGuid().ToString(),
                // IdDepartment = bomonMeta.IdDepartment?.Trim(),
                NameDepartment = bomonMeta.NameDepartment?.Trim(),
                IdFaculty      = IdFaculty?.Trim(),
                CreateDate     = DateTime.Now,
                IsActive       = true,
                IsDelete       = false
            };
            var Result = await _departmentRepository.InsertAsync(_bomon);

            if (Result >= 0)
            {
                return(new ActionResultReponese <string>(Result, "thanh cong", "Department", null));
            }
            return(new ActionResultReponese <string>(Result, "that bai", "Department", null));
        }