Ejemplo n.º 1
0
 public CustomResponse GetUserServiceDetail(int OrderServiceId)
 {
     // create object of response class
     response = new CustomResponse();
     try
     {
         using (businessLogin = new MotormechsRepository())
         {
             UserServiceDetailList bService = businessLogin.GetUserServiceDetail(OrderServiceId);
             if (bService.Status == true)// if Service Exist
             {
                 response.IsSuccess = true;
                 // Set Message
                 response.Message      = bService.Message;
                 response.ResponseData = bService.List;
             }
             else // if Service not exist
             {
                 response.IsSuccess = false;
                 response.Message   = bService.Message;
             }
         }
     }
     catch (Exception ex)
     {
         response.IsSuccess = false;
         response.Message   = ex.Message.ToString();
     }
     return(response);
 }
Ejemplo n.º 2
0
        public UserServiceDetailList GetUserServiceDetail(int OrderId)
        {
            UserServicesDetail           eUserServiceDetail     = new UserServicesDetail();
            UserServiceDetailList        bUserServiceDetail     = new UserServiceDetailList();
            List <UserServiceDetailList> bUserServiceDetailList = new List <UserServiceDetailList>();

            try
            {
                using (obj = new MotorMechsEntities())
                {
                    bUserServiceDetailList = obj.Services.Join(obj.UserServicesDetails, s => s.Id, usd => usd.UserSeviceId,
                                                               (s, usd) => new { s, usd })
                                             .Where(u => (u.usd.OrderServiceId == OrderId && u.usd.IsActive == true))
                                             .Select(z => new UserServiceDetailList
                    {
                        UserSeviceId   = z.usd.Id,
                        UserSeviceName = z.s.Name,
                        OrderServiceId = z.usd.OrderServiceId.Value
                    }).ToList();


                    if (bUserServiceDetailList.Count > 0)// Service Persent
                    {
                        bUserServiceDetail.List    = bUserServiceDetailList;
                        bUserServiceDetail.Message = "Record Found";
                        bUserServiceDetail.Status  = true;
                    }
                    else // No Services
                    {
                        bUserServiceDetail.List    = bUserServiceDetailList;
                        bUserServiceDetail.Message = "No Record Found";
                        bUserServiceDetail.Status  = true;
                    }
                }
            }
            catch (Exception e)
            {
                bUserServiceDetail.List    = null;
                bUserServiceDetail.Message = "Some Error Occued";
                bUserServiceDetail.Status  = false;
            }
            return(bUserServiceDetail);
        }