public ServiceResponse <Data.Models.SkiResort> CloseSkiResort(Data.Models.SkiResort skiResort) { try { skiResort.IsOpen = false; _db.Update(skiResort); _db.SaveChanges(); return(new ServiceResponse <Data.Models.SkiResort> { Data = skiResort, Time = DateTime.UtcNow, Message = "Close ski resort", IsSuccess = true }); } catch (Exception e) { return(new ServiceResponse <Data.Models.SkiResort> { Data = skiResort, Time = DateTime.UtcNow, Message = "Error closing ski resort", IsSuccess = false }); } }
/// <summary> /// Creating new Addresses /// </summary> /// <param name="address"></param> /// <returns></returns> ServiceResponse <Data.Models.Address> IAddressService.CreateAddress(Data.Models.Address address) { try { _db.Addresses.Add(address); _db.SaveChanges(); return(new ServiceResponse <Data.Models.Address> { Data = address, Time = DateTime.UtcNow, Message = "Saved new address", IsSuccess = true }); } catch (Exception e) { return(new ServiceResponse <Data.Models.Address> { Data = address, Time = DateTime.UtcNow, Message = "Error saveing new address", IsSuccess = false }); } }
/// <summary> /// Creating new opinion /// </summary> /// <param name="opinion"></param> /// <returns></returns> ServiceResponse <Data.Models.Opinion> IOpinionService.CreateOpinion(Data.Models.Opinion opinion) { try { _db.Opinions.Add(opinion); _db.SaveChanges(); return(new ServiceResponse <Data.Models.Opinion> { Data = opinion, Time = DateTime.UtcNow, Message = "Saved new opinion", IsSuccess = true }); } catch (Exception e) { return(new ServiceResponse <Data.Models.Opinion> { Data = opinion, Time = DateTime.UtcNow, Message = "Error saveing new opinion", IsSuccess = false }); } }
/// <summary> /// Creating new skirun /// </summary> /// <param name="skiRun"></param> /// <returns></returns> ServiceResponse <Data.Models.SkiRun> ISkiRunService.CreateSkiRun(Data.Models.SkiRun skiRun) { try { _db.SkiRuns.Add(skiRun); _db.SaveChanges(); return(new ServiceResponse <Data.Models.SkiRun> { Data = skiRun, Time = DateTime.UtcNow, Message = "Saved new skirun", IsSuccess = true }); } catch (Exception e) { return(new ServiceResponse <Data.Models.SkiRun> { Data = skiRun, Time = DateTime.UtcNow, Message = "Error saveing new skirun", IsSuccess = false }); } }