예제 #1
0
 public Model.API.Customer.RegisterResponse CustomerRegister(Model.API.Customer.RegisterRequest registerRequest)
 {
     try
     {
         if (customerRepository.CheckCustomerExist(registerRequest))
         {
             return(new ParkMark.Model.API.Customer.RegisterResponse()
             {
                 Status = ParkMark.Model.ResponseStatus.DuplicateObject,
                 EndUserMessage = "Duplicate Email"
             });
         }
         else
         {
             var customer = Mapper.Map <Repository.Customer>(registerRequest);
             var response = new Model.API.Customer.RegisterResponse();
             customer = customerRepository.Add(customer);
             customerRepository.Save();
             response.Email          = customer.Email;
             response.Status         = Model.ResponseStatus.Success;
             response.EndUserMessage = "Register Successful";
             return(response);
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(new Model.API.Customer.RegisterResponse()
         {
             Status = Model.ResponseStatus.InternalError,
             EndUserMessage = "An InternalError Happend"
         });
     }
 }
예제 #2
0
        public AddParkingResponse AddParking(AddParkingRequest addParkingRequest)
        {
            try
            {
                if (parkingRepository.CheckParkingExist(addParkingRequest))
                {
                    return(new AddParkingResponse
                    {
                        Status = Model.ResponseStatus.DuplicateObject,
                        EndUserMessage = "Duplicate Position"
                    });
                }
                else
                {
                    var parking  = Mapper.Map <Repository.ParkingPlace>(addParkingRequest);
                    var response = new Model.API.Customer.RegisterResponse();
                    parkingRepository.Add(parking);
                    parkingRepository.Save();

                    return(new AddParkingResponse
                    {
                        Status = Model.ResponseStatus.Success,
                        EndUserMessage = "Position Added Successful",
                    });
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(new AddParkingResponse
                {
                    Status = Model.ResponseStatus.InternalError,
                    EndUserMessage = "An InternalError Happend"
                });
            }
        }