Exemplo n.º 1
0
 public IActionResult Admin(VolunteerHoursModel model)
 {
     if (ModelState.IsValid)
     {
         model.CreateOrUpdate(_context, model.UserId);
     }
     return(RedirectToAction("Admin"));
 }
Exemplo n.º 2
0
 public IActionResult Index(VolunteerHoursModel model)
 {
     if (ModelState.IsValid)
     {
         model.CreateOrUpdate(_context, _userManager.GetUserId(User));
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 3
0
 public VolunteerHoursModel Insert(VolunteerHoursModel model)
 {
     using (var tran = _unitOfWork.BeginTransaction())
     {
         var profileId = _unitOfWork.Repository <ProfileEntity>().Set.FirstOrDefault(x => x.UserId == _authUser.Id).Id;
         var entity    = new VolunteerHoursEntity
         {
             ActivityType = model.ActivityType,
             Date         = model.Date,
             Start        = model.Start,
             End          = model.End,
             ProfileId    = profileId,
             Semester     = model.Semester
         };
         _unitOfWork.Repository <VolunteerHoursEntity>().Insert(entity);
         tran.Commit();
         return(model);
     }
 }
Exemplo n.º 4
0
        public IActionResult Post([FromBody] VolunteerHoursModel model)
        {
            var result = _service.Insert(model);

            return(Ok(result));
        }