Пример #1
0
        public ActionResult Index(ProjectionModel ProjectionEntryModel)
        {
            ProjectionModel model = new ProjectionModel();

            if (Session["Username"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            else
            {
                if (ProjectionEntryModel != null)
                {
                    var ProjectionEntryModelRecord = new ProjectionEntryModel()
                    {
                        ProjectID         = ProjectionEntryModel.ProjectID,
                        OpportunityID     = ProjectionEntryModel.OpportunityID,
                        WarehouseId       = ProjectionEntryModel.WarehouseID,
                        Quantity          = ProjectionEntryModel.Quantity,
                        Created           = ProjectionEntryModel.Created,
                        DateInvoiced      = ProjectionEntryModel.DateInvoiced,
                        ActivityId        = ProjectionEntryModel.ActivityId,
                        ServiceActivityId = ProjectionEntryModel.ServiceActivityId,
                        ProjectManagerID  = ProjectionEntryModel.ProjectManagerID,
                    };

                    var returnstatus = ProjectionHelperService.ProjectionEntryAdd(ProjectionEntryModelRecord);
                }
            }
            return(View(LoadDropDownsServices.ProjectionDropdowns()));
        }
Пример #2
0
        public static async Task <ReturnModel> ProjectionEntryAdd(ProjectionEntryModel ProjectionActivityEntryRecord)
        {
            ReturnModel ReturnResult = new ReturnModel();

            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri(TimeSheetAPIURl);
                HttpResponseMessage response = client.PostAsJsonAsync(string.Format("Projection/ProjectionActivityEntry"), ProjectionActivityEntryRecord).Result;
                if (response.IsSuccessStatusCode)
                {
                    ReturnResult = await response.Content.ReadAsAsync <ReturnModel>();

                    HttpContext.Current.Session["ResultMessage"] = ReturnResult.Message;
                }
                else
                {
                    HttpContext.Current.Session["ErrorMessage"] = ReturnResult.Message;
                }
            }
            return(ReturnResult);
        }