private int SaveTaskDetails(vmTask _vmTask) { crm_DailySalesTask _objSalesTask = new crm_DailySalesTask(); int result = 0; string Address = ""; try { Int64 nextRow = _dbContext.crm_DailySalesTask.Count() + 1; _objSalesTask.DailySalesTaskID = nextRow; _objSalesTask.UserID = _vmTask.UserID; _objSalesTask.BuyerName = _vmTask.BuyerName; _objSalesTask.Description = _vmTask.Description; _objSalesTask.Achivement = _vmTask.Achivement; _objSalesTask.Latitude = _vmTask.Latitude; _objSalesTask.Longitude = _vmTask.Longitude; Address = GetAddress(_objSalesTask.Latitude, _objSalesTask.Longitude); _objSalesTask.Address = Address; _dbContext.crm_DailySalesTask.Add(_objSalesTask); _dbContext.SaveChanges(); result = 1; } catch { result = 0; } return(result); }
public ResponseModel SaveTask(vmTask _vmTask) { ResponseModel _modelObj = new ResponseModel(); int result = SaveTaskDetails(_vmTask); if (result == 1) { _modelObj.Status = true; _modelObj.Message = "Task Saved"; } else { _modelObj.Status = false; _modelObj.Message = "Task Saved faill"; } return(_modelObj); }