Example #1
0
        public void Add()
        {
            request.VotingName        = "aerosmith 3";
            request.VotingDescription = "Singer";
            request.DueDateString     = "12-12-2020";
            request.CategoryID        = 2;
            request.CurrentLogin      = "******";

            var isValid = facade.Add(request);

            Assert.True(isValid.Result.IsSuccess);
        }
Example #2
0
 public async Task <IActionResult> Add([FromBody] VotingRequest request)
 {
     try
     {
         authHelper.IsLogin(ref CurrentLogin, ref response, HttpContext.User.Identity as ClaimsIdentity);
         if (response.IsSuccess)
         {
             request.CurrentLogin = CurrentLogin;
             if (request.VotingID > 0)
             {
                 return(Ok(await facade.Update(request)));
             }
             else
             {
                 return(Ok(await facade.Add(request)));
             }
         }
         return(Ok(response));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }