示例#1
0
 // GET: api/EmployeeAvailability/5
 public IHttpActionResult Get(string id)
 {
     try
     {
         Guid g = new Guid(id);
         //UserId = "2303eff9-b95e-4d3c-8397-bf4eaae25c4f";
         using (UnitOfWork m = new UnitOfWork(new MMAContext(), new Guid(UserId), UserEmail))
         {
             VMEmployeeAvailability vm = VMEmployeeAvailability.GetVmEAvailability(m.EmployeeAvailabilityRecs.Get(g));
             return(Ok(vm));
         }
     }
     catch (Exception ex)
     {
         //todo Log Exception
         return(BadRequest(ex.GetAllMessages()));
     }
 }
示例#2
0
        public IHttpActionResult GetByEmployee(string employeeEmail, string strStartDate)
        {
            try
            {
                DateTime startD = CommonUtils.DateTimeStringToDatetime(strStartDate);

                using (UnitOfWork m = new UnitOfWork(new MMAContext(), new Guid(UserId), UserEmail))
                {
                    var l = m.EmployeeAvailabilityRecs.GetByEmployee(employeeEmail, startD);
                    List <VMEmployeeAvailability> al = new List <VMEmployeeAvailability>(l.Count());
                    foreach (var t in l)
                    {
                        al.Add(VMEmployeeAvailability.GetVmEAvailability(t));
                    }
                    return(Ok(al));
                }
            }
            catch (Exception e)
            {
                //ToDo Log exception
                return(BadRequest(e.GetAllMessages()));
            }
        }