Esempio n. 1
0
        public override int?Save(string action)
        {
            var data = new CustomTimeLogDataModel();

            data.CustomTimeLogId      = CustomTimeLogId;
            data.CustomTimeLogKey     = CustomTimeLogKey;
            data.PersonId             = PersonId;
            data.ApplicationId        = ApplicationId;
            data.CustomTimeCategoryId = CustomTimeCategoryId;
            data.PromotedDate         = WorkDate;
            data.Value = NoofFilesPromoted;


            if (action == "Insert")
            {
                var dtCustomTimeLog = CustomTimeLogDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtCustomTimeLog.Rows.Count == 0)
                {
                    var customTimeLogId = CustomTimeLogDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                CustomTimeLogDataManager.Update(data, SessionVariables.RequestProfile);
            }

            return(data.CustomTimeLogId);
        }
Esempio n. 2
0
        public void Create([FromBody] dynamic data)
        {
            var jsonString = JsonConvert.SerializeObject(data);
            var dataQuery  = JsonConvert.DeserializeObject <CustomTimeLogDataModel>(jsonString);

            dataQuery.PromotedDate  = DateTime.Now;
            dataQuery.ApplicationId = SessionVariables.RequestProfile.ApplicationId;

            CustomTimeLogDataManager.Create(dataQuery, SessionVariables.RequestProfile);
        }