예제 #1
0
        public JsonResult GetUserCalender(string startDate, string endDate)
        {
            DateTime start            = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            TimeSpan startDateTimSpan = TimeSpan.FromMilliseconds(long.Parse(startDate));

            start = start.Add(startDateTimSpan);

            TimeSpan endDateTimSpan = TimeSpan.FromMilliseconds(long.Parse(endDate));
            DateTime end            = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            end = end.Add(endDateTimSpan);

            GetUserCalenderRequest request = new GetUserCalenderRequest()
            {
                RequestedBy = this.Identity.ToUserID(),
                RoleId      = this.Identity.ToRoleID(),
                AccountId   = this.Identity.ToAccountID(),
                StartDate   = start,
                EndDate     = end
            };
            GetUserCalenderResponse response = userService.GetUserCalender(request);

            response.CalenderSlots.ToList().ForEach
                (t =>
            {
                t.start = t.start.ToUtc();
                t.end   = t.start.AddHours(1);
            });
            return(Json(new { success = true, response = response.CalenderSlots }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public HttpResponseMessage GetUserCalenderData(string startDate, string endDate)
        {
            DateTime start            = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            TimeSpan startDateTimSpan = TimeSpan.FromMilliseconds(long.Parse(startDate));

            start = start.Add(startDateTimSpan);

            TimeSpan endDateTimSpan = TimeSpan.FromMilliseconds(long.Parse(endDate));
            DateTime end            = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            end = end.Add(endDateTimSpan);

            GetUserCalenderRequest request = new GetUserCalenderRequest()
            {
                RequestedBy = this.UserId,
                RoleId      = this.RoleId,
                AccountId   = this.AccountId,
                StartDate   = start,
                EndDate     = end
            };
            GetUserCalenderResponse response = userService.GetUserCalender(request);

            response.CalenderSlots.ToList().ForEach
                (t =>
            {
                t.start = t.start.ToUtc();
                t.end   = t.start.AddHours(1);
            });
            return(Request.BuildResponse(response));
        }