Ejemplo n.º 1
0
 public HttpResponseMessage Add(DeliveryTypeVM deliveryTypeVM, string token)
 {
     try
     {
         //check token info
         var isAllow = iAccountService.IsTokenAvailable(token);
         if (!isAllow)
         {
             return(PostResponseFail(HttpStatusCode.ExpectationFailed, ExceptionMessageConstant.TokenNotAvailable));
         }
         //proceed request
         var tokenizedUserId = iAccountService.GetUserIdByToken(token);
         deliveryTypeVM.UserId = tokenizedUserId;
         iDeliveryTypeService.AddDeliveryType(deliveryTypeVM);
         return(PostResponseSuccess(HttpStatusCode.OK, SucessMessageConstant.RequestHandleSuccessful));
     }
     catch (NullReferenceException)
     {
         return(PostResponseFail(HttpStatusCode.ExpectationFailed, ExceptionMessageConstant.RequestNullExceptionMassge));
     }
     catch (Exception ex)
     {
         return(PostResponseFail(HttpStatusCode.ExpectationFailed, ex.Message));
     }
 }
Ejemplo n.º 2
0
        public IActionResult Index()
        {
            var types = deliveryTypeService.GetDeliveryTypes().ToList();
            List <DeliveryTypeVM> typeVM = new List <DeliveryTypeVM>();

            foreach (var item in types)
            {
                DeliveryTypeVM dT = new DeliveryTypeVM();
                dT.ID   = item.Id;
                dT.Name = item.DeliveryTypeName;
                typeVM.Add(dT);
            }
            return(View(typeVM));
        }
Ejemplo n.º 3
0
 public void AddDeliveryType(DeliveryTypeVM deliveryTypeVM)
 {
     addDeliveryTypeHandler.Handle(new DeliveryTypeAddCommand {
         DeliveryType = deliveryTypeVM
     });
 }