Ejemplo n.º 1
0
        public async Task <ScholarshipModel> InsertAsync(ScholarshipModel model)
        {
            var entity = new ScholarshipEntity
            {
                Admission = model.Admission,
                Budget    = model.Budget,
                Status    = model.Status,
                Name      = model.Name
            };

            await _unitOfWork.Repository <ScholarshipEntity>().InsertAsync(entity);

            model.Id = entity.Id;

            return(model);
        }
Ejemplo n.º 2
0
        public async Task <ScholarshipModel> UpdateAsync(ScholarshipModel model)
        {
            var entity = _unitOfWork.Repository <ScholarshipEntity>().Set.FirstOrDefault(x => x.Id == model.Id);

            if (entity != null)
            {
                entity.Admission = model.Admission;
                entity.Budget    = model.Budget;
                entity.Status    = model.Status;
                entity.Name      = model.Name;

                await _unitOfWork.Repository <ScholarshipEntity>().UpdateAsync(entity);

                return(model);
            }

            return(null);
        }
Ejemplo n.º 3
0
 public async Task <IActionResult> Put([FromBody] ScholarshipModel model)
 {
     return(Ok(await _service.UpdateAsync(model)));
 }