public object AddEventType([FromBody] EventTypeParam obj)
 {
     try
     {
         EventTypeBusiness save = new EventTypeBusiness();
         var result             = save.SaveEventType(obj);
         return(result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
示例#2
0
        public object SaveEventType(EventTypeParam b)
        {
            if (b.EventType == null)
            {
                return(new Error()
                {
                    IsError = true, Message = "Required EventType"
                });
            }
            var data = db.Tbl_EventType_Master.FirstOrDefault(r => r.EventType == b.EventType);

            if (data != null)
            {
                return(new Error()
                {
                    IsError = true, Message = "Duplicate Entry Not Allowed"
                });
            }
            try
            {
                Tbl_EventType_Master obj = new Tbl_EventType_Master();
                obj.EventType    = b.EventType;
                obj.Status       = 1;
                obj.CreatedBy    = 1;
                obj.CreatedDate  = System.DateTime.Today.Date;
                obj.ModifiedBy   = null;
                obj.ModifiedDate = System.DateTime.Today.Date;
                db.Tbl_EventType_Master.Add(obj);
                db.SaveChanges();
                return(new Result()
                {
                    IsSucess = true, ResultData = "Created Event Type"
                });
            }
            catch (Exception e)
            {
                return(new Error()
                {
                    IsError = true, Message = e.Message
                });
            }
        }