Exemple #1
0
        public IEnumerable <WorkShiftView> Get()
        {
            var models = repo.getAllWorkShifts();
            var views  = WorkShiftView.getViews(models);

            return(views);
        }
Exemple #2
0
        public void Put(int id, WorkShiftView view)
        {
            view.id = id;
            var model = view.getModel();

            model.updated = DateTime.UtcNow;
            repo.update(model);
        }
        public HttpResponseMessage Post(WorkShiftView view)
        {
            var model = view.getModel();
            model.created = DateTime.UtcNow;
            model.updated = DateTime.UtcNow;
            model = repo.createWorkShift(model);
            view = new WorkShiftView(model);

            var response = Request.CreateResponse<WorkShiftView>(HttpStatusCode.Created, view);
            string uri = Url.Route(null, new { id = view.id });
            response.Headers.Location = new Uri(Request.RequestUri, uri);
            return response;
        }
 public HttpResponseMessage Get(int id)
 {
     var model = repo.getWorkShift(id);
     if (model == null)
     {
         return Request.CreateResponse(HttpStatusCode.NotFound);
     }
     else
     {
         var view = new WorkShiftView(model);
         return Request.CreateResponse(HttpStatusCode.OK, view);
     }
 }
Exemple #5
0
        public HttpResponseMessage Get(int id)
        {
            var model = repo.getWorkShift(id);

            if (model == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            else
            {
                var view = new WorkShiftView(model);
                return(Request.CreateResponse(HttpStatusCode.OK, view));
            }
        }
Exemple #6
0
        public HttpResponseMessage Post(WorkShiftView view)
        {
            var model = view.getModel();

            model.created = DateTime.UtcNow;
            model.updated = DateTime.UtcNow;
            model         = repo.createWorkShift(model);
            view          = new WorkShiftView(model);

            var    response = Request.CreateResponse <WorkShiftView>(HttpStatusCode.Created, view);
            string uri      = Url.Route(null, new { id = view.id });

            response.Headers.Location = new Uri(Request.RequestUri, uri);
            return(response);
        }
Exemple #7
0
        public HttpResponseMessage WorkShifts(int id)
        {
            var model = repo.getEmployee(id);

            if (model == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            else
            {
                var workShifts = model.workShifts;
                var views      = WorkShiftView.getViews(workShifts);
                return(Request.CreateResponse(HttpStatusCode.OK, views));
            }
        }
 public void Put(int id, WorkShiftView view)
 {
     view.id = id;
     var model = view.getModel();
     model.updated = DateTime.UtcNow;
     repo.update(model);
 }