Example #1
0
        public async Task <bool> AddStudent(StudentParameter studentParameter)
        {
            var student = Mapper.Map <StudentParameter, Student>(studentParameter);

            UnitOfWork.Repo.Add(student);
            return(await UnitOfWork.SaveChanges() > 0);
        }
        public async Task <IActionResult> AddStudent(StudentParameter studentParameter)
        {
            if (ModelState.IsValid)
            {
                var isAdded = await _StudentBusiness.AddStudent(studentParameter);

                if (isAdded)
                {
                    return(Ok("Added successfully"));
                }
            }

            return(BadRequest(ModelState));
        }